[Solved] How can I raise a number to power in javascript? [duplicate]


Math.pow(base, exponent) is the answer.

console.log(Math.pow(4, 3)) // 64

In addition, newer browers [quotation needed] supports the ** operation:

console.log(4 ** 3) // 64

If you want to test if your current browser supports it simply click on “Run code snippet”. If you see 64, congratulations! It works.

0

solved How can I raise a number to power in javascript? [duplicate]