Interview Q&A · JavaScript · 14 questions in this topic

Modern JavaScript (ES6+) — JavaScript Interview Q&A

All JavaScript topics

What each era changed — from arrow functions to optional chaining, records and explicit resources. Part of Modern JavaScript (ES6+) · 204 questions in the JavaScript bank.

What did ES6/ES2015 change (the big bang)?

Answer

let/const, arrows, classes, modules, template literals, destructuring, spread/rest, default params, promises, Map/Set, symbols, iterators/generators, proxies. It modernized syntax, modularity and async foundations in one release — the baseline all later years extend.

Scope-plus-modules-plus-promises is the ES6 core.

Key points

  1. 1Syntax — arrows, classes, templates, destructuring.
  2. 2Scope — let/const, modules.
  3. 3Async/data — promises, Map/Set, symbols.

💡 Name one per bucket to show breadth, not a memorized list.

What did ES2016–ES2020 add (the usability years)?

Answer

Exponent operator and includes (2016); async/await, Object.entries/values, padStart/End (2017); rest/spread properties, Promise.finally (2018); flat/flatMap, Object.fromEntries, optional catch binding (2019); optional chaining (?.), nullish coalescing (??), BigInt, globalThis, Promise.allSettled (2020).

?.-plus-?? is the 2020 headline every codebase felt.

Example

Example.jsjs
const city = user?.address?.city ?? 'unknown'; // safe + defaulted

What did ES2021–ES2024 add?

Answer

Logical assignment (??=, &&=, ||=) and replaceAll, Promise.any (2021); at(), top-level await, class statics/fields, Error cause (2022); findLast, hashbang, Symbols-as-WeakMap-keys (2023); Object.groupBy, Promise.withResolvers, RegExp v-flag, Atomics.waitAsync (2024).

Recent years polish ergonomics (groupBy, at, withResolvers) over paradigm shifts.

Example

Example.jsjs
// config.port ??= 3000; // assign-if-nullish
// arr.at(-1); // last element, readable

💡 groupBy-plus-at-plus-withResolvers is the 2024 trio to name.

Recommended resourcesAffiliate links · may earn us a commission

Classic DSA interview booksThe reference books interviewers themselves learned from — great next to the visualizers.See the books Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits