HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
📝
프론트엔드 스쿨 교안(1기)
/
📝
(코테준비) 자료구조 및 알고리즘
/
☝
JS 100제 - 1권
/
🔥
문제46
/
✔️
답안
✔️

답안

let arr = []; let sum = 0; for (let i=0; i<20; i++){ arr[i] = i+1; } arr.forEach((n) => { while(n !== 0){ sum += (n % 10); n = Math.floor(n/10); } }) console.log(sum);