JS: Value Types

By Xah Lee. Date: . Last updated: .

Any value in JavaScript is one of the following type.

JavaScript variables don't have type.

JavaScript data types
type namesample valueexplanation
† undefinedundefinedundefined is the only value of this type.
[see JS: undefined]
† nullnullnull is the only value of this type.
[see JS: null]
† booleantruetrue and false are the only possible values.
[see JS: true, false]
† string"xyz" [see JS: String Object]
† number34Includes special value NaN (Not A Number) and Infinity
[see JS: NaN] [see JS: Infinity]
† symbol Symbol() Always-unique value primarily for use as property keys. [see JS: Symbol Tutorial]
object{"x":3}The “object” type is a collection of key/value pairs. Array, function, date, regex, etc are all objects.
[see JS: Object Type]

† A value of these types are called primitive values.

[see JS: Primitive Value]

ECMAScript 2015 §ECMAScript Data Types and Values#sec-ecmascript-data-types-and-values

Find the Type of a Value

JS: “typeof” Operator

JS Variable

  1. Value Types
  2. let
  3. const
  4. var
  5. var Order
  6. var Scope
  7. Global Variable
  8. Destructuring Assignment

JS Types Topic

  1. JS: Value Types
  2. JS: Primitive Value
  3. JS: Object Type
  4. JS: “typeof” Operator
  5. JS: Determine Type of Object
  6. JS: Object.prototype.isPrototypeOf
  7. JS: Property Key “constructor”
  8. JS: “instanceof” Operator
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog