ES2016 Features with simple examples


ES2016 aka ES7 is the version of ECMAScript corresponding to the year 2016. This version does not include as many new features as those that appeared in ES6 (2015). However, some useful features have been incorporated.

This article introduces the features provided by ES2016 in easy code examples. In this way, you can quickly understand the new features without the need for a complex explanation.

Of course, it is necessary to have a basic knowledge of JavaScript to fully understand the best ones introduced.

The new #JavaScript features in ES2016 are:

➡️ Array.prototype.includes ➡️️ Exponentiation operator


The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.

Array.prototype.includes return a Boolean which is true if the value valueToFind is found within the array.

Values of zero are all considered to be equal, regardless of sign, but false is not considered to be the same as 0.

const fruits = [🍐, 🥑, 🍇];

fruits.includes(🥑)      // true
fruits.includes(🍉)      // false
fruits.includes(🍇, 3)   // false
fruits.includes(🍇, -1)  // true
fruits.includes(NaN)  // true

If fromIndex is greater than or equal to the length of the array, false is returned. The array will not be searched.

const fruits = [🍐, 🥑, 🍇];

fruits.includes(🍇, 3)    // false
fruits.includes(🍇, 100)  // false

If fromIndex is negative, the computed index is calculated to be used as a position in the array at which to begin searching for valueToFind. If the computed index is less or equal than -1 * arr.length, the entire array will be searched.

const fruits = [🍐, 🥑, 🍇]

fruits.includes(🍐, -100) // true
fruits.includes(🥑, -100) // true
fruits.includes(🍇, -100) // true
fruits.includes(🍐, -2)   // false

// array length is 3
// fromIndex is -100
// computed index is 3 + (-100) = -97

Exponentiation operator

The exponential operator (**) is an infix operator for exponentiation.


produces the same result as

    x ** y


JavaScript is a live language, and that is something very healthy for web development. Since the appearance of ES6 in 2015 we are living a vibrant evolution in the language. In this post we have reviewed the features that arise in ES2016 (aka ES7).

Although many of these features may not be essential for the development of your Web application, they are giving possibilities that could be achieved before with tricks or a lot of verbosity.

Today, we’re going to show ECMAScript features from 2015:

James Swanson's photo

It was really interesting to check out these examples. Post them here if you want to. I don't mind that at all.

Conor Culas's photo

You know what, I had no idea that it's possible to use such icons or whatever those are in arrays and conditional statements. I'm impressed. Whatever I need to write a dissertation methodology

ruthclub's photo

Nice information and thanks for sharing this to us. Spin bikes are an affordable and excellent piece of gym equipment to have in your home. Read on for our detailed information of the best spin bikes in 2020 .

LizBrumbaugh's photo

Many useful features have been incorporated in ES2016 which can be very healthy for web development. I think it will be also helpful to work in cheap writing service with ES2016 as it offers a range of features necessary for writing. I am hopeful that this will be proved a useful one very soon.