JS Versions
In this page:
What 'ECMAScript' Means
JavaScript is the language most people use the name for, but ECMAScript is the actual official specification that defines what JavaScript must do -- version names like ES5, ES6, and ES2015 all refer to specific releases of that specification, which browser vendors then implement.
उदाहरण: What 'ECMAScript' Means
console.log("ES6", "ES2015"); // same release, two common names
The Major Milestones: ES5 and ES6
ES5 (2009) standardized foundational features like strict mode and array methods (forEach, map, filter).
ES6/ES2015 was a much larger release, introducing let/const, arrow functions, classes, template literals, destructuring, promises, and modules -- changes significant enough that 'writing modern JavaScript' generally means writing ES6-style code.
उदाहरण: The Major Milestones: ES5 and ES6
[1, 2, 3].forEach(n => console.log(n)); // ES5
const double = n => n * 2; // ES6/ES2015
console.log(double(5));
Yearly Releases Since ES6
Since ES6/ES2015, ECMAScript has shifted to a yearly release cadence -- ES2016 added the exponentiation operator (**) and Array.includes(), ES2017 added async/await, ES2020 added optional chaining and nullish coalescing, and so on -- each release adding smaller, more targeted features rather than a sweeping overhaul.
उदाहरण: Yearly Releases Since ES6
console.log(2 ** 3); // ES2016: exponentiation operator
console.log([1, 2].includes(2)); // ES2016: Array.includes()
// ES2017 added async/await, ES2020 added ?. and ??
Checking Browser Support for a Feature
Before relying on a specific JavaScript feature in production code meant for a broad audience, checking a compatibility reference (like the "Can I use" website or MDN's browser compatibility tables) confirms whether your target browsers actually support it, or whether a fallback or transpiler is needed.
उदाहरण: Checking Browser Support for a Feature
console.log(typeof Array.prototype.at); // check support before relying on newer methods
Using Tools to Support Older Browsers
Transpilers (like Babel) convert modern JavaScript syntax into an older, more widely supported equivalent, and polyfills add missing built-in functions to older environments that lack them -- together, these tools let developers write modern code while still supporting audiences on older browsers.
उदाहरण: Using Tools to Support Older Browsers
console.log("Babel transpiles modern syntax; core-js polyfills missing built-ins.");
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: