Primitive data types are the basic building blocks used to store values in JavaScript.
- String
String is used to store text.
Ex:
let name = "Anandhi";
- Number
Number is used to store numbers.
Ex:
let age = 21;
- BigInt
BigInt is used to store very large numbers.
Ex:
let bigNumber = 12345678901234567890n;
- Boolean
Boolean stores only true or false.
Ex:
let isStudent = true;
- Undefined
Undefined means a variable is declared but no value is given.
Ex:
let city; Null
- Null Null means an empty or no value. Ex : let address = null;
- Symbol
Symbol is used to create a unique value.
Ex:
let id = Symbol("id");

Top comments (0)