function solution(s, n) {
var answer = '';
for(let i=0;i<s.length;i++){
if(s[i]===" "){
answer+=" "
continue;
}
let charCode=s.charCodeAt(i);
let newCharCode=charCode+n;
if(charCode>=97&&newCharCode>122){
newCharCode-=26;
answer+=String.fromCharCode(newCharCode)
console.log(charCode,newCharCode,String.fromCharCode(newCharCode));
continue;
}
if(charCode<=90&&newCharCode>90){
newCharCode-=26
}
console.log(charCode,newCharCode,String.fromCharCode(newCharCode));
answer+=String.fromCharCode(newCharCode)
}
return answer;
}
로직 제대로 짜놓고
오타때매 왜안되지 30분고민한거 진짜 탈모유발함