728x90

✨ 제곱 값을 구하기 위해 사용하는 helper method

💻Example Code

const num = 2;

console.log( Math.pow(num, 2) );
console.log( Math.pow(num, 10) );
console.log( Math.pow(num, -2) );

실행 결과

🧨 2의 -2제곱은 1/4이므로, 0.25가 나온다.

😋 base^exponent라고 생각하면 된다.
base의 exponent제곱!

👉 자세한 내용은 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow

 

Math.pow()

The Math.pow() function returns the base to the exponent power, that is, baseexponent.

developer.mozilla.org

 

'JavaScript > Built-in Method etc.' 카테고리의 다른 글

Math.PI  (0) 2020.01.28
Array.prototype.forEach()  (0) 2020.01.23
Math.random()  (0) 2020.01.18
Math.ceil()  (0) 2020.01.18
Array.prototype.filter()  (0) 2020.01.11

+ Recent posts