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

JavaScript Basics

  1. JavaScript Basics
  2. Value Types
  3. true, false
  4. Operators
  5. Variable
  6. if then else
  7. for while do Loop
  8. Array Basics
  9. Object Basics
  10. RegExp Tutorial

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.