Array.prototype.includes

Includes 方法用来检测数组中是否包含某个元素,返回布尔类型值

指数操作符

在 ES7 中引入指数运算符「**」,用来实现幂运算,功能与 Math.pow 结果相同

//includes 返回true|false  indexOf返回下标
const mingzhu = ['西游记','红楼梦','三国演义','水浒传'];
//判断
console.log(mingzhu.includes('西游记'));
console.log(mingzhu.includes('聊斋志异'));

// **
console.log(2 ** 10);// 
console.log(Math.pow(2, 10));

相关文章:

  • 2021-03-12
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2019-12-20
  • 2021-12-25
  • 2022-03-08
猜你喜欢
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-10-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案