JavaScript: 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
undefined †undefinedundefined is the only value of this type.
[see undefined]
null †nullnull is the only value of this type.
[see null]
boolean †truetrue and false are the only possible values.
[see true, false]
string †"xyz" [see String Object]
number †34Includes special value NaN (Not A Number) and Infinity
[see NaN] [see Infinity]
symbol † Symbol() Always-unique value primarily for use as property keys. [see Symbol Tutorial]
object{"x":3}The “object” type is a collection of key/value pairs. Array, function, date, regex, etc are all objects.
[see Object Type]

† A value of these types are called Primitive Value.

JavaScript Value Types

JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS in Depth

Basic Syntax

Value Types

Variable

String

Function

Property

Object and Inheritance

Array

Constructor/Class

Iterable 🌟

Misc