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 † undefined undefined is the only value of this type.
null † null null is the only value of this type.
boolean † true true, false are the only possible values.
string † "xyz" 〔see String Overview
number † 34 Includes special value NaN (Not A Number) and 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 and 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