Calculates the nth root of a number.
By default, it computes the square root (i.e., degree = 2).
The number to take the root of.
The degree of the root (e.g., 2 for square root, 3 for cube root).
The nth root of value.
value
Will throw an error if degree is 0.
degree
root(9); // returns 3 (square root)root(27, 3); // returns 3 (cube root)root(16, 4); // returns 2 (fourth root) Copy
root(9); // returns 3 (square root)root(27, 3); // returns 3 (cube root)root(16, 4); // returns 2 (fourth root)
Calculates the nth root of a number.
By default, it computes the square root (i.e., degree = 2).