I'd like to reduce this code using the spread syntax to remove the for loop, any ideas?
function shiftChar() {
let aCharArray = prompt("Enter a word").split("");
for (let i = 0; i < aCharArray.length; i++) {
aCharArray[i] = String.fromCharCode(aCharArray[i].charCodeAt(0) + 1);
}
alert(aCharArray);
}
This doesn't work
function shiftChar() {
let aCharArray = prompt("Enter a word").split("");
aCharArray = String.fromCharCode(...aCharArray.charCodeAt(0) + 1);
alert(aCharArray);
}