JavaScript mendeteksi nomor kuadrat
var isSquare = function (n) {
return n > 0 && Math.sqrt(n) % 1 === 0;
};
Master Cheeto Fu
var isSquare = function (n) {
return n > 0 && Math.sqrt(n) % 1 === 0;
};
var x = Math.sqrt(num);
console.log(Math.sqrt(4)); // 2
console.log(Math.sqrt(16)); // 4
console.log(Math.sqrt(64)); // 8
console.log(Math.sqrt(100)); // 10
let number = 16
Math.sqrt(number);
//output = 4
let sqrt = (c, depth = 100, x = 1) =>
depth <= 0 ? x :
sqrt(c, depth - 1, x - (Math.pow(x, 2) - c)/(2*x))
console.log(sqrt(2));
let n = 64;
let root = 5;
Math.pow(n, 1/root);
// output 2;