<대소문자 변환>
: 대소문자와 소문자가 같이 존재하는 문자열을 입력받아 대문자는 소문자로 소문자는 대문자로 변환하여 출력하는 프로그램을 작성한다.
앞에서 배운 내용 그대로 하면 된다.
<script> function solution(s){ let answer=""; for(let x of s){ if(x===x.toUpperCase()) answer+=x.toLowerCase(); else answer+=x.toUpperCase(); } return answer; } console.log(solution("StuDY")); </script>