There are 7 primitive data types in Javascript.
- Number
- String
- Boolean
- Null
- Undefined
- Symbol
- Integer -
1
- Floating point -
1.1
- Infinity -
Infinity
- Single quote -
'Hello'
- Double quote -
"Hello"
- Backtick -
`Hello`
true
false
null
undefined
Symbol('Hello')
NOTE: Since all numbers are stored in a 64-bit floating-point format (IEEE 754 standard), there is a limit to how big a number can be. Javascript integers are only accurate up to 15 digits (53 bits). To store larger numbers, you can use the BigInt data type.
To create a BigInt, you can add an n
at the end of the number or use the BigInt()
function.
1234567890123456789012345678901234567890n
BigInt(1234567890123456789012345678901234567890)