
The JavaScript Math.pow() returns the value of x to the power of y (xʸ).
Syntax:
Math.pow(x, y)
x – the base.
y – the exponent.
Example:
<!DOCTYPE html>
<html>
<body>
<p id="example"></p>
<script>
let a = Math.pow(0, 2);
let b = Math.pow(1, 1);
let c = Math.pow(1, 7);
let d = Math.pow(3, 4);
let e = Math.pow(-3, 3);
let f = Math.pow(1, 4);
document.getElementById("example").innerHTML =
a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e + "<br>" + f;
</script>
</body>
</html>
Output:
Math.pow(x,y) returns the value of x to the power of y:
Enjoy coding!
Read also: