Matt - 11 months ago 73

Javascript Question

What is the benefit to using the ECMAScript 2016 exponentiation operator over the current

`Math.pow()`

`Math.pow(2, 2) => 4`

`2 ** 2 => 4`

Answer Source

None. As you can read in the spec draft, both `Math.pow`

and the `**`

exponentation operator cast their arguments/operands to numbers and use the very same algorithm to determine the result.