JS: Value Types

By Xah Lee. Date: . Last updated: .

Variables don't have type.

Any value in JavaScript is one of the following type.

undefined †

undefined is the only value of this type.

null †

null is the only value of this type.

boolean †

true and false are the only possible values.

string †

e.g. "xyz"

number †

e.g. 34

Includes special value NaN and Infinity

BigInt †

new in JS2020

e.g. 34n

big integer.

xtodo
symbol †

Always-unique value primarily for use as property keys.

object

e.g. {"x":3}

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

† A value of these types are called Primitive Value.

JavaScript. Value Types