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

답안

// 내장함수 사용 const n = prompt('숫자를 입력해주세요.'); parseInt(n, 10); console.log(n.toLocaleString()); // 재귀함수 사용 function comma(s) { if (s.length <= 3) { return s; } else { return comma(s.slice(0, s.length - 3)) + ',' + s.slice(s.length - 3); } } const n = prompt('숫자를 입력해주세요.'); console.log(comma(n));