JS References

JavaScript references provide detailed syntax and method documentation. Use them for quick lookup.

On this page

JS Keywords Reference

Keywords are reserved words that have a special meaning in JavaScript. You cannot use them as variable names in the same context.

// Examples
let x = 10;
const y = 20;

if (x < y) {
  console.log("x is smaller");
}

Common keywords you will use often:

  • let, const, var
  • if, else, switch, case, default
  • for, while, do, break, continue
  • function, return, class, extends, new
  • try, catch, finally, throw
  • import, export, await, async
  • typeof, instanceof, in, delete

JS Keywords Reserved

Reserved keywords and future-reserved words should not be used as identifiers (variable/function/class names). Some are only reserved in strict mode or in certain contexts.

Tip: If you need a name close to a keyword, add a suffix/prefix:

// Avoid: let class = 1; // invalid
let className = "Card";
let defaultValue = 0;

JS Operator Reference

Operators perform operations on values. Here are the main operator groups with short examples.

  • Arithmetic: + - * / % **
  • Assignment: = += -= *= /= ??= &&= ||=
  • Comparison: == === != !== > >= < <=
  • Logical: && || !
  • Nullish: ?? (nullish coalescing)
  • Ternary: condition ? a : b
  • Optional chaining: ?.
  • Bitwise: & | ^ ~ << >>
let a = 10;
let b = 3;

console.log(a + b);   // 13
console.log(a ** b);  // 1000

console.log(a === 10); // true

const user = null;
console.log(user ?? "Guest"); // Guest

JS Operator Precedence

Operator precedence decides which operations run first. When in doubt, use parentheses to make it explicit.

Common precedence (high to low):

  • Parentheses: ( )
  • Member access / call: ., [], (), optional chaining ?.
  • Unary: !, typeof, + (unary), - (unary)
  • Exponentiation: **
  • Multiplication/division: *, /, %
  • Addition/subtraction: +, -
  • Comparisons: >, >=, <, <=, instanceof, in
  • Equality: ==, ===, !=, !==
  • Logical AND: &&
  • Logical OR: ||
  • Nullish coalescing: ?? (be careful mixing with &&/||)
  • Ternary: ?:
  • Assignment: =, +=, ??= ...
let x = 10 + 2 * 3;     // 16
let y = (10 + 2) * 3;   // 36

console.log(x, y);
// Precedence tip: be explicit with parentheses
const value = null;
const result = (value ?? 0) + 5;
console.log(result); // 5

Next Step

Continue with JS ECMAScript 2026 (or JS Versions) to understand how JavaScript evolves and which features are safe to use.

JS References Examples (8)