function solution(left, right) {
let answer = 0;
let arr = [];
for(let i = 0; i <= Math.abs(left - right); i++){
let sum = 0;
arr.push(left + i);
for(let j = 1; j <= arr[i]; j++){
if(arr[i] % j == 0) sum++;
}
sum % 2 == 0 ? answer += arr[i] : answer -= arr[i]
}
return answer;
}
성공