Clean β’ Professional
Primitive data types are simple, immutable (unchangeable) values stored directly in memory.
When you copy them into another variable, the value itself is copied, not a reference.
JavaScript has 7 primitive data types:

Represents any number β whole, decimal, or even special values like Infinity and NaN (Not a Number).
const price = 9.99;
let count = 5;
console.log(price + count); // 14.99
console.log(10 / 0); // Infinity
console.log("abc" * 2); // NaN
A sequence of characters inside quotes (', ", or ```).
const name = "Ravi";
let greeting = `Hello, ${name}!`;
console.log(greeting); // Hello, Ravi!
console.log(name + " ji"); // Ravi ji
Represents logical values: true or false.
const isActive = true;
let hasAccess = false;
console.log(isActive && !hasAccess); // true
A variable that has been declared but not assigned any value.
let x;
console.log(x); // undefined
console.log(x === undefined); // true
Represents intentional absence of value.
const data = null;
console.log(data === null); // true
console.log(data ?? "Empty"); // Empty
A unique and immutable value, often used as object keys to avoid naming conflicts.
const key = Symbol("id");
const obj = { [key]: 123 };
console.log(obj[key]); // 123
Represents integers larger than the safe limit for regular numbers (2^53 - 1).
const big = 12345678901234567890n; // Notice the 'n'
console.log(big + 10n); // 12345678901234567900n
Β