devnotes.

Primitive Data Types

JavaScript has seven primitive types: string, number, boolean, undefined, null, symbol, and bigint.

let city = "Chattogram";     // string
let age = 25;                // number
let isActive = true;         // boolean
let notSet;                  // undefined
let empty = null;            // null
let id = Symbol("id");       // symbol
let big = 9007199254740993n; // bigint

Everything else — objects, arrays, and functions — is a reference type, not a primitive. Use the typeof operator to check a value's type (typeof age returns "number"), though typeof null famously returns "object", a long-standing quirk kept for backward compatibility rather than fixed.

number covers both integers and floating-point values using the IEEE 754 double-precision format, which means very large integers can lose precision. bigint (added in ES2020, written with a trailing n) exists specifically for integers larger than Number.MAX_SAFE_INTEGER.