Primitive data types recap
Let's quickly summarize some of the main points discussed so far:
- There are five primitive data types in JavaScript:
- Number
- String
- Boolean
- Undefined
- Null
- Everything that is not a primitive data type is an object.
The primitive number data type can store positive and negative integers or floats, hexadecimal numbers, octal numbers, exponents, and the special numbers-
NaN
,Infinity
, and-Infinity
. - The string data type contains characters in quotes. Template literals allow embedding of expressions inside a string.
- The only values of the Boolean data type are
true
andfalse
. - The only value of the null data type is the
null
value. - The only value of the undefined data type is the
undefined
value. - All values become
true
when converted to a Boolean, with the exception of the following six falsy values:""
null
undefined
0
NaN
false