JavaScript: New Features 2016 to 2020

By Xah Lee. Date: . Last updated: .

Since 2015, new features are added to JavaScript the language each year.

JS2015

2015 Features

JS2016

  • Array.prototype.includes
  • The power operator **. Example, 3 ** 2 === 9. [see Operators]
  • JS2017

    JS2018

    Destructure object rest properties

    For example, we have let { c, ...remainProperties } = { a:1, b:2, c:3 };, then c is 3. remainProperties is { a:1, b: 2 } . See: • Destructuring AssignmentFunction Argument Destructure

    Spread operator for object literal

    For example, { ...{ a:1, b:2}, c:3 } becomes { a:1, b:2, c:3 } . See: Spread Operator

    Regex Features

    promise finally, async iteration

    JS2019

    JS2020

    globalThis
    A variable that is alias to the Global Object the Global Object
    ??
    Nullish Coalescing Operator
    ?.
    Optional Chaining Operator
    String.prototype.matchAll
    String.prototype.matchAll
    Property Order Guaranteed
    Now object property's order is guaranteed by spec.

    bigint

    const x = 10n;
    console.log( typeof x === "bigint" ); // true
    

    dynamic import

    import * as xyz from "./xyz.js";

    Import/Export

    import.meta

    export {abc} from "./xyz.js";
    export * from "./xyz.js";

    import() syntax

    Promise.allSettled

    Promise Tutorial

    JS2021

    Number Separator
    Numbers can have lowline _ between digits. For example, you can write 1_000.
    Logical AND assignment operator x &&= y
    Assigns y to x if Boolean(x) eval to true. see JS: Operators
    Logical OR assignment operator x ||= y
    Assigns y to x if Boolean(x) eval to false.
    Logical Nullish assignment operator x ??= y
    Assigns y to x if x is null or undefined
    JS in Depth
    XAH  BUY NOW

    JS in Depth

    JS Obj Ref

    DOM


    JS in Depth

    Basic Syntax

    Value Types

    Variable

    String

    Function

    Property

    Object and Inheritance

    Array

    Constructor/Class

    Iterable 🌟

    Misc