ECMAScript2016(ES7)2个新特效

1、Array.prototype.includes

[1, 2, 3].includes(3);  // true
[1, 2, 3].includes(4);  // false

[1, 2, 3].indexOf(3);  // 2
[1, 2, 3].indexOf(4);  // -1

includes() 和 indexOf() 方法类似,主要区别是:
includes()能找到NaN,
indexOf()不能找到NaN

[NaN].includes(NaN);  // true
[NaN].indexOf(NaN);  // -1

2、取幂运算

let num = 3 ** 3;  // 27

等同于 Math.pow(3, 3)

原文地址:https://www.cnblogs.com/Zting00/p/7497617.html