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

답안

let a = prompt('문자열을 입력하세요.'); let b = []; let s = ''; for (let i=0; i<a.length; i++){ //toLowerCase() 메서드는 문자열을 소문자로, toUpperCase() 메서드는 문자열을 대문자로 변환하여 반환합니다. if(a[i] === a[i].toLowerCase()){ b.push(a[i].toUpperCase()); } else { b.push(a[i].toLowerCase()); } } for (let j=0; j<b.length; j++){ s += b[j]; } console.log(s);