JavaScript is a dynamic, prototype-based programming language standardized as ECMAScript and used across browsers, servers (Node.js), and embedded runtimes. This cheat sheet covers the most-used language constructs, standard library APIs, and core Web/Node primitives — from everyday ES2015+ syntax through the newest ES2025/2026 features such as Iterator helpers, Set methods, explicit resource management, RegExp.escape, and Promise.try. Examples are intentionally minimal and runnable, emphasizing correct modern syntax, predictable semantics, and common pitfalls. Use the links in the first column as the source of truth for behavior, edge cases, and compatibility.
What This Cheat Sheet Covers
This topic spans 16 focused tables and 241 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Core Types & Equality
Every JavaScript value belongs to one of the eight primitive types or to Object. Understanding the difference between reference types and primitives, the two equality algorithms (== vs === vs Object.is), and the quirks of typeof null prevents a large class of subtle bugs.
| Type | Example | Description |
|---|---|---|
typeof "hello" → "string" | • Returns a string naming the primitive type • typeof null === "object" is a legacy bug | |
0.1 + 0.2 !== 0.3 | • IEEE-754 64-bit floating point • all integers ≤ 2^53−1 are exact | |
9007199254740992n + 1n | • Arbitrary-precision integers • append n• cannot mix with Number without explicit conversion | |
"café".length → 5 | • Immutable UTF-16 code-unit sequence • emoji/surrogate pairs may need for...of or [...str] to iterate | |
Boolean(0) → false | Only false, 0, "", null, undefined, NaN, 0n are falsy. | |
let x = null | • Intentional absence of value • typeof null is "object" (legacy spec error). | |
let y; y === undefined | • Uninitialized variable or missing property • distinct from null. | |
Symbol("id") !== Symbol("id") | • Always unique primitive • used for metaprogramming hooks and collision-free property keys |