JavaScript: Value Types
Any value in JavaScript is one of the following type.
JavaScript variables don't have type.
type name | sample value | explanation |
---|---|---|
undefined † | undefined | undefined is the only value of this type.[see undefined] |
null † | null | null is the only value of this type.[see null] |
boolean † | true | true and false are the only possible values.[see true, false] |
string † | "xyz" | [see String Overview] |
number † | 34 | Includes 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.