What’s New in JavaScript? A Deep Dive into ES2015‑ES2019 Features

This article walks you through the most important JavaScript language enhancements from ES2015 to ES2019, covering let/const, arrow functions, classes, modules, promises, async/await, new string and object methods, collections, generators, and upcoming ESNext proposals, all with clear examples and code snippets.

Node Underground
Node Underground
Node Underground
What’s New in JavaScript? A Deep Dive into ES2015‑ES2019 Features

I wrote this article to help you quickly catch up with the latest developments in JavaScript after the pre‑ES6 era.

ECMAScript Introduction

ECMAScript (ES) is the standard that JavaScript implementations follow; it is often abbreviated as ES.

let and const

ES2015 introduced let and const as block‑scoped alternatives to var. let allows re‑assignment, while const creates a read‑only binding.

let a = 1;
const b = 'test';

Arrow Functions

Arrow functions provide a concise syntax and lexical this binding.

const add = (x, y) => x + y;

Classes

ES2015 added class syntax as syntactic sugar over prototype inheritance.

class Person {
  constructor(name) { this.name = name; }
  hello() { return `Hello, I am ${this.name}.`; }
}
const p = new Person('Flavio');
console.log(p.hello());

Modules

ES Modules allow explicit import and export of values.

// uppercase.js
export default str => str.toUpperCase();

// main.js
import toUpperCase from './uppercase.js';
console.log(toUpperCase('test'));

New String Methods

ES2015 added repeat() and codePointAt(). ES2017 added padStart() and padEnd(). ES2019 added trimStart() and trimEnd().

'Ho'.repeat(3); // 'HoHoHo'
'abc'.padStart(5, '0'); // '00abc'
'  test  '.trimEnd(); // '  test'

New Object Methods

ES2015 introduced Object.is(), Object.assign(), and Object.setPrototypeOf(). ES2019 added Object.fromEntries().

const copy = Object.assign({}, {a:1});
const entries = Object.entries({x:10});
const obj = Object.fromEntries(entries);
console.log(obj); // {x:10}

Spread Operator and Rest Properties

The ... operator can expand arrays, objects, or strings, and can be used for rest properties in destructuring.

const a = [1,2,3];
const b = [...a,4,5];
const {first, second, ...others} = {first:1, second:2, third:3, fourth:4};

Collections: Set, WeakSet, Map, WeakMap

ES2015 added Set and Map for unique values and key‑value storage, plus their weak counterparts.

const s = new Set([1,2,3]);
s.add(4);
const m = new Map([['color','red'],['size','large']]);
console.log(m.get('color'));

Generators

Generators are functions that can pause execution with yield and resume later.

function* gen() {
  const a = yield 1;
  yield a * 2;
}
const g = gen();
console.log(g.next().value); // 1
console.log(g.next(5).value); // 10

Promises and Async/Await

Promises handle asynchronous operations; async / await (ES2017) make them look synchronous.

async function fetchData() {
  const res = await fetch('/data.json');
  return await res.json();
}
fetchData().then(console.log);

Promise Enhancements

ES2018 added Promise.prototype.finally(), Promise.all(), Promise.race(), and Array.prototype.includes(). ES2016 introduced the exponentiation operator **.

Promise.all([p1,p2]).then(([r1,r2])=> console.log(r1,r2));
2 ** 3; // 8

Regular Expression Improvements (ES2018)

Added lookbehind assertions, Unicode property escapes ( \p{...}), named capture groups, and the s (dotAll) flag.

const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/;
const m = re.exec('2020-12-31');
console.log(m.groups.year); // 2020

ESNext (Future Proposals)

Features already at stage 4 include Array.prototype.flat / flatMap, optional catch binding, Object.fromEntries, String.prototype.trimStart/trimEnd, Symbol.prototype.description, JSON improvements, and Function.prototype.toString enhancements.

const flat = [1, [2, [3]]].flat(Infinity); // [1,2,3]
const sym = Symbol('test');
console.log(sym.description); // 'test'

Conclusion

This guide covered the most significant JavaScript language updates from ES2015 through ES2019, providing practical examples to help developers adopt the new syntax and APIs.

ECMAScript version table
ECMAScript version table
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

es6ES2018ES2015
Node Underground
Written by

Node Underground

No language is immortal—Node.js isn’t either—but thoughtful reflection is priceless. This underground community for Node.js enthusiasts was started by Taobao’s Front‑End Team (FED) to share our original insights and viewpoints from working with Node.js. Follow us. BTW, we’re hiring.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.