指数运算符(Rick Waldron)

新提出来的特性是将 ** 作为指数操作的中缀运算符:

 x ** y

 

与以下表达式运算结果相同:

Math.pow(x, y)

 

示例:

let squared = 3 ** 2; // 9

let num = 3;
num **= 2;
console.log(num); // 9

 

扩展阅读:

相关文章:

  • 2022-12-23
  • 2021-12-25
  • 2021-12-23
  • 2021-06-01
猜你喜欢
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2021-06-17
  • 2021-06-01
  • 2022-01-16
  • 2021-11-23
相关资源
相似解决方案