@tempots/std
root() function
Computes the nth root (index
) of base
.
Signature:
root: (base: number, index: number) => number
Parameters
Parameter |
Type |
Description |
---|---|---|
base |
number |
The base number. |
index |
number |
The index of the root. |
Returns: number
The nth root of the base number.
Example
root(8, 3) // returns 2
root(27, 3) // returns 3
root(16, 4) // returns 2