Earlier ECMAScript versions were named by numbers, such as ES5 and ES6. Starting in 2016, versions are named by the year of release, like ES2016, ES2018, ES2020, and so on.
This chapter covers the new features introduced in ECMAScript 2016:
Since March 2017, ES2016 has been fully supported in all modern browsers.
ES2016 is not supported in Internet Explorer.
The exponentiation operator (**) raises the first operand to the power of the second operand.
let x = 5; let z = x ** 2; |
x ** y produces the same result as Math.pow(x, y).
let x = 5; let z = Math.pow(x,2); |
The exponentiation assignment operator (**=) raises the value of a variable to the power of the right-hand operand.
let x = 5; x **= 2; |
The Exponentiation Operator has been supported in all modern browsers since March 2017.
ECMAScript 2016 introduced the Array.includes()
method, which allows us to check if an element exists in an array.
const fruits = [“Banana”, “Orange”, “Apple”, “Mango”]; fruits.includes(“Mango”); |
The Array.includes() method has been supported in all modern browsers since August 2016.