The pow(x,y)
method returns the value of xy.
pow() |
Yes | Yes | Yes | Yes | Yes |
Math.pow(x, y);
Parameter | Description |
---|---|
x | Required. The base |
y | Required. The exponent |
return the value of xy.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from w w w . ja va2s. c om-->
document.getElementById("demo").innerHTML = Math.pow(4, 2);
}
</script>
</body>
</html>
The code above is rendered as follows: