274 B
274 B
title, tags
| title | tags |
|---|---|
| nthRoot | math,beginner |
Calculates the nth root of a given number.
- Use
Math.pow()to calculatexto the power of1/nwhich is equal to the nth root ofx.
const nthRoot = (x, n) => Math.pow(x, 1 / n);
nthRoot(32, 5); // 2