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]

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

  1. Value Types
  2. Primitive Value
  3. Object Type
  4. “typeof” Operator
  5. Find Object's Type
  6. Object.prototype.isPrototypeOf
  7. Property Key “constructor”
  8. “instanceof” Operator
Like it? Help me by telling your friends. Or, 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. CSS
  3. JavaScript
  4. JS Obj Ref
  5. DOM
  6. SVG
  7. Blog