출처 : https://programmers.co.kr/learn/courses/30/lessons/12934
function solution(n) {
if (Math.sqrt(n) > 0 && Math.sqrt(n) % 1 === 0 ){
return ((Math.sqrt(n) + 1) ** 2);
} else {
return -1
}
}
Math.sqrt()
: 제곱근을 구하는 메소드**
거듭제곱 연산자 ex) 3 ** 3
-> 3의 3제곱