Primitive Data Types
JavaScript has seven primitive data types. Primitives are immutable values that are stored directly in memory.
string: Textual data, enclosed in quotes, immutable sequence of characters.
number: Numeric values including integers and floating-point numbers.
bigint: Arbitrary-precision integers for large numbers beyond Number.MAX_SAFE_INTEGER.
boolean: Logical values true or false.
undefined: Value assigned to variables that have been declared but not initialized.
null: Intentional absence of any object value.
symbol: Unique and immutable primitive values, often used as object property keys.
Primitives are compared by value, not reference. Operations on primitives create new values.
Primitive Type Examples
// String
const name = "Alice";
console.log(typeof name); // "string"
// Number
const age = 25;
const price = 19.99;
console.log(typeof age); // "number"
// BigInt
...Each primitive type has distinct characteristics and use cases.