
์ ์ n์ด ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋ n์ ๊ฐ ์๋ฆฌ ์ซ์์ ํฉ์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์
n โค 1,000,000| n | result | 
|---|---|
| 1234 | 10 | 
| 930211 | 16 | 
์ ์ถ๋ ฅ ์ #1
์ ์ถ๋ ฅ ์ #2
const solution = (n) => String(n).split("").map(a => +a).reduce((a,b) => a+b,0)