Skip to content

Instantly share code, notes, and snippets.

@peterkibuchi
Last active May 28, 2021
Embed
What would you like to do?
Codecademy 'Whale Talk' Challenge Project.
let input = 'I just keep moving forward.';
const vowels = ['a', 'e', 'i', 'o', 'u'];
let resultArray = [];
input = input.toLowerCase();
for (let i = 0; i < input.length; i++) {
// console.log(i);
for (j = 0; j < vowels.length; j++) {
// console.log(j);
if (input[i] === vowels[j]) {
resultArray.push(vowels[j].toUpperCase());
}
}
if (input[i] === 'e' || input[i] === 'u') {
resultArray.push(input[i].toUpperCase());
}
}
console.log(resultArray.join(''));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment