JS: Value Types
Any value in JavaScript is either a Primitive type or Object type.
Variables don't have type.
primitive type
- undefined
-
undefinedis the only value of this type. - null
-
nullis the only value of this type. - string
- number
-
Includes special value NaN and Infinity
- BigInt
-
big integer.
- boolean
-
trueandfalseare 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.