394 B
394 B
title, type, language, tags, author, cover, dateModified
| title | type | language | tags | author | cover | dateModified | |
|---|---|---|---|---|---|---|---|
| Nth root of number | snippet | javascript |
|
chalarangelo | tree-roots | 2021-01-06T22:47:48+02:00 |
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