Skip to content

pow ​

Calculates the power of a number raised to another.

Syntax ​

typescript
pow(base: number, exponent: number): number

Parameters ​

NameTypeDescription
basenumberThe base number.
exponentnumberThe exponent value.

Return ​

TypeDescription
numberThe result of exponentiation.

Example ​

typescript
pow(2, 3); // 8
pow(5, 0); // 1
pow(4, 0.5); // 2
pow(-2, 3); // -8

Notes ​

  • Throws TypeError if any argument is not a number.

References ​

Released under the MIT License.