JS: Value Types

By Xah Lee. Date: . Last updated: .

Variables don't have type.

Any value in JavaScript is one of the following 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 Overview
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. Many object has special purpsoes, e.g. Array, function, date, regex, etc.
〔see Object Type

† A value of these types are called Primitive Value.

JavaScript, Value Types