"apple".charCodeAt(0)
String.fromCharCode(코드번호)
https://programmers.co.kr/learn/courses/30/lessons/12926
function solution(s, n) {
return s
.split("")
.map(char => {
if (char === " ") return " "
return move(char.charCodeAt(0), n)
})
.join("")
}
function move(curCode, move) {
if (curCode <= "Z".charCodeAt(0)) {
// 대문자인 경우
return String.fromCharCode(
"A".charCodeAt(0) + ((curCode + move - "A".charCodeAt(0)) % 26)
)
} else {
// 소문자
return String.fromCharCode(
"a".charCodeAt(0) + ((curCode + move - "a".charCodeAt(0)) % 26)
)
}
}