Learn how to use JavaScript Exponentiation (**).
Exponentiation Operator
The exponentiation operator (**) raises the first operand to the power of the second operand:
Example
js
let x = 5;
let z = x ** 2; // result is 25
x ** y produces the same result as Math.pow(x, y):
Example
js
let x = 5;
let z = Math.pow(x,2); // result is 25
Exponentiation Assignment
The exponentiation assignment operator (**=) raises the value of a variable to the power of the right operand.
Example
js
let x = 5;
x **= 2; // result 25
Read more about JavaScript Operators in the JavaScript Operator Tutorial.