Skip to content

Primitive Data Types

JavaScript has seven primitive data types: number, string, boolean, undefined, null, symbol (ES6), and bigint (ES2020). Primitives are immutable and compared by value.

// Examples
let num = 42; // number
let str = "hello"; // string
let bool = true; // boolean
let und; // undefined
let empty = null; // null
let sym = Symbol("id"); // symbol
let big = 123n; // bigint

We’ll explore each in the following sections.