function LetterChanges(str) {
var newArray = [];
str=str.toLowerCase();
for ( var i = 0; i < str.length; i++){
newArray[i] = str.charCodeAt(i);
}
var updatedArray = newArray.map(function(item){
if(item === 32){
return item
}else return item + 1;
});
var change = String.fromCharCode.apply(null,updatedArray);
var correct1 = String.fromCharCode.apply(null , updatedArray);
var changeZ = correct1.replace(/['{']/g , 'a')
//This is where I search for vowels
for (var k = 0; k < changeZ.length; k++){
if (changeZ[i] === 'a' || changeZ[i] === 'e' || changeZ[i] === 'i' ||changeZ[i] === 'o' || changeZ[i] === 'u'){
changeZ.replace(changeZ[i].toUpperCase())
}
}
return changeZ;
}
// keep this function call here
LetterChanges(readline());
I have been stuck on this all day today. I feel like the answer is on the tip of my fingers. Please help. Thank you in advance!
Here is the challenge question:
Using the JavaScript language, have the function LetterChanges(str) take the str parameter being passed and modify it using the following algorithm. Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string.