Data types in JavaScript
Primitive types
- String - It represents a series of characters and is written with quotes. A string can be represented using a single or a double quote.
- Number - It represents a number and can be written with or without decimals.
- BigInt - This data type is used to store numbers which are above the limitation of the Number data type. It can store large integers and is represented by adding βnβ to an integer literal.
- Boolean - It represents a logical entity and can have only two values :
true
or false
. Booleans are generally used for conditional testing.
- Undefined - When a variable is declared but not assigned, it has the value of undefined and itβs type is also
undefined
.
- Null - It represents a non-existent or a invalid value.
- Symbol - It is a new data type introduced in the ES6 version of javascript. It is used to store an anonymous and unique value.
Non-primitive types
- Object - Used to store collection of data.