Skip to content Skip to sidebar Skip to footer

Exponentiation in JavaScript is represented by the double asterisk (**). It is used to raise the left operand to the power of the right operand.

Here are some examples:

2 ** 3 // Output: 8
4 ** 2 // Output: 16
Math.pow(5, 2) // Output: 25
5 ** 0 // Output: 1

In the first example, 2 raised to the power of 3 equals 8. In the second example, 4 raised to the power of 2 equals 16. The third example shows how the exponentiation operator can be used in combination with the Math.pow method. In the fourth example, any number raised to the power of 0 equals 1.

Copyright © 2023. All rights reserved.

Copyright © 2023. All rights reserved.