べき乗演算子(**)

(式と演算子)
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Exponentiation

べき乗演算子 (**) は、1 つ目のオペランドを2 つ目オペランドの累乗にした結果を返す。これは Math.pow と同等だが、オペランドとして BigInt も受け入れる。

console.log(3 ** 4); // 81(3の4乗)
console.log(3 ** 2.5); // 15.588457268119896(3の2.5乗)
console.log(10 ** -2); // 0.01(10の-2乗)
console.log(2 ** (3 ** 2)); // 512(2の9乗)
console.log((2 ** 3) ** 2); // 64(8の2乗)
console.log(NaN ** 2); // NaN(NaNの2乗)
inserted by FC2 system