iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

JS Versions

JavaScript is the implementation of the ECMAScript spec. Each year a new edition adds features. Modern code targets ES2015+ ("ES6") at minimum; everything older is the legacy floor.

The headline editions

YearEditionBig additions
2009ES5"use strict", JSON, Object.create, getters/setters.
2015ES6 / ES2015let/const, classes, arrows, template literals, modules, Promises, Map/Set, destructuring, default/rest/spread, for…of, generators.
2016ES2016**, Array.includes.
2017ES2017async/await, Object.values/entries, string padding.
2018ES2018Object spread, async iteration, regex improvements.
2019ES2019flat/flatMap, Object.fromEntries, optional catch binding.
2020ES2020Optional chaining ?., nullish coalescing ??, BigInt, dynamic import().
2021ES2021Numeric separators, replaceAll, Promise.any, logical assignments.
2022ES2022Class fields + private (#), top-level await, at(), Object.hasOwn, error cause.
2023ES2023findLast/findLastIndex, non-mutating array methods (toSorted, toReversed, toSpliced, with).
2024+ES2024Set methods (union, intersection), Promise.withResolvers, structuredClone well-supported.

What "supported" means

A feature is shipped when the major browser engines (V8, SpiderMonkey, JavaScriptCore) all implement it. Check on caniuse.com or MDN compatibility tables before relying on bleeding-edge syntax.

Polyfills vs. transpilation

Type of featureWhat you need
New method (e.g. Array.prototype.flat)A polyfill — code that adds it to older engines.
New syntax (e.g. arrow function)A transpiler (Babel, swc) to rewrite as old syntax.
New API (e.g. structuredClone)Polyfill or fallback path.
Tip: For new projects, target the last 2 major versions of every evergreen browser. Most modern syntax then works natively — Babel only kicks in for the very newest proposals.

Example

Example
<!DOCTYPE html>
<html>
<body>

<p id="out"></p>

<script>
document.getElementById("out").textContent = "Hello from JS Versions!";
</script>

</body>
</html>
Try it Yourself »

Exercise

Name the year that gave us classes, arrows, and modules.

Answer: ES

Test yourself

Q1. The "big" ES update was…
Q2. async/await landed in…
Q3. Optional chaining `?.` landed in…

Discussion

Loading…