https://programmers.co.kr/learn/courses/30/lessons/12947
function solution(x) { var answer = true; const arr = []; let n = x; while(n > 0) { arr.push(n % 10); n = Math.floor(n / 10); } const sum = arr.reduce((a, b) => a + b); return x % sum === 0 ? true : false; }