JavaScript Find Nth Root of Number

The Nth Root of a number is a number that is multiplied by itself n times to get the initial value. Have a look at the Wiki page for more information.

Use Math.pow() to calculate x to the power of 1 / n which is equal to the nth root of x.

const nthRoot = (x, n) => Math.pow(x, 1 / n);

let result = nthRoot(81, 4);

console.log(result) // 3

Software Engineer | Ethical Hacker & Cybersecurity...

Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.