Primitive Data Types in JavaScript
From the JavaScript cheat sheet · Variables & Data Types · verified Jul 2026
Primitive Data Types
JavaScript primitive types
javascript
// String
const text = 'Hello';
const template = `Value: ${text}`;
// Number (integers and floats)
const integer = 42;
const float = 3.14;
// Boolean
const isActive = true;
const isComplete = false;
// undefined & null
let notDefined; // undefined
const empty = null;
// Symbol & BigInt
const sym = Symbol('id');
const big = 123n; // or BigInt(123)💡 JavaScript has 7 primitive types: string, number, boolean, undefined, null, symbol, bigint
⚡ Primitives are immutable - operations create new values
📌 Use null for intentional empty values, undefined for uninitialized
🔥 BigInt is for integers beyond Number.MAX_SAFE_INTEGER