JavaScript has 7 primitive data types: string, number, bigint, boolean, undefined, null, and symbol.
Primitive data types are immutable and stored directly in memory. JavaScript has 7 primitives:
1. String - Textual data enclosed in quotes 2. Number - Integer and floating-point numbers (64-bit floating point) 3. BigInt - Integers of arbitrary length (suffix with 'n') 4. Boolean - true or false 5. Undefined - Variable declared but not assigned a value 6. Null - Intentional absence of any object value 7. Symbol - Unique and immutable identifier (ES6)
Everything else in JavaScript is an object (arrays, functions, objects, etc.).
// String
const str = 'Hello World';
// Number
const num = 42;
const float = 3.14;
// BigInt
const big = 9007199254740991n;
// Boolean
const bool = true;
// Undefined
let undef;
console.log(undef); // undefined
// Null
const empty = null;
// Symbol
const sym = Symbol('description');Using typeof to check user input types before processing or submitting data
Boolean primitives for enabling/disabling features in applications
Using BigInt for handling large integers beyond Number.MAX_SAFE_INTEGER in currency or cryptographic operations
Using Symbol to create private-like properties that won't conflict with other code
Build a robust typeof wrapper that correctly handles null, arrays, and other edge cases
Create a visualization showing pass-by-value vs pass-by-reference behavior