728x90
๐ 11 - ๋๋ฌธ์๋ก ํต์ผ
์์ ํผ ๋ฌธ์ ์ ๋์ผํ ๋ฐฉ์์ผ๋ก ํ๋ฉด ๋๋ค.
console.log(solution("ItisTimeToStudy"));
// ASCII
function solution(s) {
let ans = "";
for(let x of s){
let num = x.charCodeAt();
if (num>=97 && num<=122) ans+=String.fromCharCode(num-32);
else ans+=x
}
return ans;
}
// toLowerCase, toUpperCase
function solution(s){
let ans = "";
for (let string of s){
if(string === string.toLowerCase()) ans += string.toUpperCase();
else ans += string;
}
return ans;
}
๋ฐ์ํ
'Algorithm > ์ธํ๋ฐ(inflearn)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ ์๋ฐ์คํฌ๋ฆฝํธ(JavaScript) ] 13 - ๊ฐ์ฅ ๊ธด ๋ฌธ์์ด (0) | 2021.08.12 |
---|---|
[ ์๋ฐ์คํฌ๋ฆฝํธ(JavaScript) ] 12 - ๋์๋ฌธ์ ๋ณํ (0) | 2021.08.12 |
[ ์๋ฐ์คํฌ๋ฆฝํธ(JavaScript) ] 10 - ๋ฌธ์ ์ฐพ๊ธฐ (0) | 2021.08.11 |
[ ์๋ฐ์คํฌ๋ฆฝํธ(JavaScript) ] 09 - A๋ฅผ #์ผ๋ก (0) | 2021.08.11 |
[ ์๋ฐ์คํฌ๋ฆฝํธ(JavaScript) ] 08 - ์ผ๊ณฑ ๋์์ด (0) | 2021.08.11 |
๋๊ธ