power
The power() method raises a number to a given exponent. It calculates the value of a number multiplied by itself a certain number of times.
Interactive example
Syntax
Classic signature
typescript
function power<
GenericInput extends number
>(
input: GenericInput,
exponent: number
): numberCurried signature
typescript
function power<
GenericInput extends number
>(
exponent: number
): (input: GenericInput) => numberParameters
input: The base number to raise to a power (classic signature only).exponent: The exponent to which to raise the number.
Return value
returns the result of input raised to the power exponent. Equivalent to value ** exponent or Math.pow(value, exponent).
