Math.pow() Method returns the value of x to the power of y (x, y). It returns the base to the exponent power, that is, base exponent
Syntax:
Math.pow(x, y)
Example:
<script> var one = Math.pow(5,3); document.writeln('Output of 5, 3 is : ' + one + '</br></br>'); var two = Math.pow(6,4); document.writeln('Output of 6, 4 is : ' + two + '</br></br>'); var three = Math.pow(-2, 5); document.writeln('Output of -2, 5 is : ' + three + '</br></br>'); var four = Math.pow(3,4); document.writeln('Output of 3, 4 is : ' + four + '</br></br>'); </script>
Output:
Output of 5, 3 is : 125 Output of 6, 4 is : 1296 Output of -2, 5 is : -32 Output of 3, 4 is : 81