ES2016 Guidelines

ECMAScript is the standard on which JavaScript is based, and is often abbreviated as ES. Discover all the information about ECMAScript and the features added in ES2016 (also known as ES7)

ES2016 (formally known as ECMAScript 2016) was completed in June 2016.

Compared with ES2015, ES2016 is a very small JavaScript version that only contains the following two functions:

  • Array.prototype.includes
  • Exponentiation operator

Array.prototype.includes()

This feature introduces a more readable syntax for checking whether an array contains elements.

In ES6 and lower versions, to check whether the array contains elements that must be usedindexOf, It checks the index in the array, and then returns-1If the element does not exist.

since-1Is evaluated as the true value, you canIs notfor example

if (![1,2].indexOf(3)) {
  console.log('Not found')
}

With this feature introduced in ES2016, we can

if (![1,2].includes(3)) {
  console.log('Not found')
}

Exponentiation operator

Exponentiation operator**equalMath.pow(), But introduce the language instead of as a library function.

Math.pow(4, 2) == 4 ** 2

This feature is a nice addition to math-intensive JS applications.

This**Operators have been standardized in multiple languages (including Python, Ruby, MATLAB, Lua, Perl, etc.).

Download mine for freeJavaScript beginner's manual


More js tutorials: