Old JS versions are named by numbers: ES5 (2009) and ES6 (2015).
From 2016, versions are named by year: ECMAScript 2016, 2017, 2018, 2019, ...
This chapter introduces the new features in ECMAScript 2016:
The exponentiation operator (**
) raises the first operand to the power of the second operand.
x ** y
produces the same result as Math.pow(x, y)
:
**=
The Exponentiation Operator is supported in all modern browsers since March 2017:
Chrome 52 | Edge 14 | Firefox 52 | Safari 10.1 | Opera 39 |
Jul 2016 | Aug 2016 | Mar 2017 | Mar 2017 | Aug 2016 |
ECMAScript 2016 introduced Array.includes
to arrays.
This allows us to check if an element is present in an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.includes("Mango");
Try it Yourself »
Array.includes
is supported in all modern browsers since August 2016:
Chrome 47 | Edge 14 | Firefox 43 | Safari 9 | Opera 34 |
Dec 2015 | Aug 2016 | Dec 2015 | Oct 2015 | Dec 2015 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!