Math.pow() Method - Math Functions

Topic

Math.pow() method of Math Functions in Javascript.
How to get the exponential power for the given base number in javascript?

Explanation

Object: Math
Method: Math.pow()
Description: To get the exponential power for a base number we use this function. The below example will get exponent power value for the given base number using math functions.

Example:


<html>
<script type="text/javascript">
document.write('4 to the power of 2 is::'+Math.pow(4,2));
document.write('</br>');
document.write('2 to the power of 2 is::'+Math.pow(2,2));
</script>
</html>

Result:




In the above example,
  • Math.pow() method returns 16 for 4 to the power of 2.
  • The exponential value for 2 to the power of 2 is 4.