주어진 배열에서 찾을 수 없는 0~9까지 숫자를 더한 수를 출력
function solution(num) {
let answer = 0;
for(let i=0; i<10; i++){
if(!num.includes(i)) answer += i;
}
return answer;
}
let numbers = [5,8,4,0,6,7,9];
console.log(solution(numbers)); // 6
function solution(numbers) {
return 45 - numbers.reduce((cur, acc) => cur + acc, 0);
}
let numbers = [5,8,4,0,6,7,9];
console.log(solution(numbers)); // 6