JS: Value Types

By Xah Lee. Date: . Last updated: .

Any value in JavaScript is either a Primitive type or Object type.

Variables don't have type.

primitive type

undefined

undefined is the only value of this type.

null

null is the only value of this type.

string
number

Includes special value NaN and Infinity

BigInt

big integer.

boolean

true and false are the only possible values.

symbol

Always-unique value primarily for use as property keys.

Object type

object

e.g. {"x":3}

The object type is a collection of key-and-value pairs, some with special purpose, such as function, date.

JavaScript. Value Types