Javascript Algorithm Number Square Number calculate 1
function sqrtIntNaive(number){ if(number == 0 || number == 1) return number; var index = 1, square = 1; while(square < number){ if (square == number){ return square; }/*w w w. ja v a2 s . co m*/ index++; square = index*index; } return index; } let a = sqrtIntNaive(9); console.log(a);