内容大纲:

image.png

Array.prototype.includes

includes() 方法,用于查找指定值是否包含在数组中。

  1. [1, 2, 3].includes(2) // true
  2. [1, 2, 3].includes(4) // false
  3. [1, 2, 3].includes(3, 3) // false
  4. [1, 2, 3].includes(3, -1) // true
  5. [1, 2, NaN].includes(NaN) // true

推荐阅读

Exponentiation Operator (**)

求幂运算符 ( ** ):

  1. console.log(3 ** 4);
  2. // expected output: 81
  3. console.log(10 ** -2);
  4. // expected output: 0.01
  5. console.log(2 ** 3 ** 2);
  6. // expected output: 512
  7. console.log((2 ** 3) ** 2);
  8. // expected output: 64

参考资料