Write a program that receives a string with both uppercase and lowercase letters as input and outputs the string by unifying all uppercase letters.
A string is entered on the first line. The length of the string does not exceed 100.
ItisTimeToStudy
A unified character string with uppercase letters is output on the first line.
ITISTIMETOSTUDY
toUpperCase()
function solution(s) {
let answer = s.toUpperCase();
return answer;
}
ASCII
codefunction solution(s) {
let answer = 0;
for (let x of s) {
let num = x.charCodeAt();
// uppercase index is 65 ~ 90 in ASCII code
// lowercase index is 97 ~ 122 in ASCII code
if (num >= 97 && num <= 122) answer += x;
// or
if (num >= 97 && num <= 122) answer += String.fromCharCode(num - 32);
}
return answer;
}