damianc / math-root

Calculates the n-th root of a number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

math-root

Calculates the n-th root of a number.

JavaScript provides methods to calculate the 2nd and 3rd root - Math.sqrt() and Math.cbrt() respectively.
... and that's it! With this method you can calculate other roots.

Math.root(x,n) - $\sqrt[n]{x}$

const two = Math.root(16, 4);
// the 4th root of 16

console.log(two);
// 2

About

Calculates the n-th root of a number.


Languages

Language:JavaScript 100.0%