幂赋值(**=)

幂赋值**=)对两个操作数执行幂运算,并将结果赋给左操作数。

尝试一下

语法

js

x **= y // x = x ** y

示例

使用幂赋值

js

let bar = 5;

bar **= 2; // 25
bar **= "foo"; // NaN

规范

Specification
ECMAScript Language Specification
# sec-assignment-operators

浏览器兼容性

BCD tables only load in the browser

参见