JS: Value Types

By Xah Lee. Date: . Last updated: .

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

Note: JavaScript is dynamically typed language, meaning, you do not have to declared a type for variables. Only values are associated with a 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.