JS: Value Types
Variables don't have type.
Any value in JavaScript is one of the following type.
- undefined †
-
undefinedis the only value of this type. - null †
-
nullis the only value of this type. - boolean †
-
trueandfalseare the only possible values. - string †
-
e.g.
"xyz" - number †
-
e.g.
34Includes special value NaN and Infinity
- BigInt †
-
new in JS2020
e.g.
34nbig 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.