Q:

how to get the square root in js


Math.sqrt(9);
 
2
var x = Math.sqrt(num);
2

Math.sqrt(9);
 //return square root of number
1
let n = 64;
let root = 6;
Math.pow(n, 1/root);
//output 2;
1
let n = 64;
let root = 6;
Math.pow(n, 1/root);
// output 2;
0
let n = 64;
let root = 5;
Math.pow(n, 1/root);
// output 2;
0
sqrt("random number, do not put quotes"); //square root
-1

New to Communities?

Join the community