Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

javascript
math
communitycreator

# What is Math.pow() in JavaScript? Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Math is a built-in object in JavaScript that contains different methods and properties used to perform mathematical operations. It contains the pow() function, which is used to compute the power of a specified number with a specified value.

## Syntax

Math.pow(base, power);

## Parameter

• base: This represents the number to be raised with power. It is of Number type.

• power: This represents the power value. It is of Number type.

Number in JavaScript is a 64-bit double-precision value which is the same as double in C# or Java.

## Return value

• Number: It returns a base raised to the power, and its type is Number.

• NaN: The function returns this if base < 0 and power is fractional.

## Example

console.log("pow(-0.16,2) = " + Math.pow(-0.16,2));console.log("pow(0,0) = " + Math.pow(0,0));console.log("pow(-2,-4) = " + Math.pow(-2,-4));console.log("pow(2,4) = " + Math.pow(2,4));console.log("pow(-2,0.4) = " + Math.pow(-2,0.4));

RELATED TAGS

javascript
math
communitycreator

CONTRIBUTOR Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Learn in-demand tech skills in half the time 