Cheat Sheets

JavaScript ES6 Cheat Sheet: Let/Const, Arrows, Destructuring & Modules

By ArpaNeuro Team September 13, 2026
JavaScript ES6 cheat sheet

ES6 (ECMAScript 2015) is the baseline of modern JavaScript: let/const, arrows, classes, template literals, destructuring, default parameters, and import/export. Later yearly editions added async/await, optional chaining, and nullish coalescing — this sheet groups the syntax you type every day.

This JavaScript cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.

Quick reference

  • let / const: const by default. let when the binding is reassigned. Block scoped. Skip var.
  • Arrow: (x) => x * 2 lexically binds this. Not constructable, no arguments object.
  • Destructure: const {title, slug} = post and const [first, ...rest] = rows.
  • Default: function greet(name = "there").
  • Spread: {...a, ...b} and [...items, next]. Later keys win on objects.
  • Rest: function f(a, ...rest) gathers remaining args into an array.
  • Module: export function x(){} / import {x} from "./x.js" with type="module".
  • Optional: user?.city and value ?? "n/a" (null or undefined only).

Copy-paste examples

Destructure, spread, and a module-style helper

Nullish ?? does not treat 0 or "" as missing. Optional chaining stops at the first nullish.

export function invoiceLabel({ id, total, paid = false }) {
  const status = paid ? 'paid' : 'due';
  return `#${id} · ${total ?? 0} · ${status}`;
}
const defaults = { currency: 'USD', paid: false };
const row = { ...defaults, id: 41, total: 99 };
const { currency, ...data } = row;

Common mistakes

  • Using arrows for object methods that need this (it will be lexical, often undefined in modules).
  • const objects are mutable — only the binding is constant. Freeze if you need that.
  • Mixing import and require in the same file without a bundler strategy.
  • Default parameters evaluating {} once incorrectly — defaults run per call, but shared object literals as defaults are a trap if you mutate them.

FAQ

  1. Is ES6 supported in browsers? Yes for current evergreen browsers. You transpile only if you must support very old environments.
  1. var vs let? var is function-scoped and hoisted as undefined. let is block-scoped and in the temporal dead zone until initialized.
  1. Do I need classes? Optional. Classes are syntax over prototypes. Functions plus closures are still valid.

Related JavaScript cheat sheets

Build with this stack

When a cheat sheet is not enough — you need a production app, a student FYP, or a custom dashboard — ArpaNeuro builds custom web development and also sells ready-made source code. Request a quote and tell us the stack.

Browse software development services or the source code marketplace if you want a working codebase instead of starting from a blank file.

← All Articles Get a Quote →