Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created November 30, 2020 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/08d08b4c6d4de3c157ef42e17753def6 to your computer and use it in GitHub Desktop.
Save codecademydev/08d08b4c6d4de3c157ef42e17753def6 to your computer and use it in GitHub Desktop.
Codecademy export
let input = 'turpentine and turtles';
const vowels = ['a', 'e', 'i', 'o', 'u'];
let resultArray = [];
for (let i = 0; i < input.length; i++) {
for (let j = 0; j < vowels.length; j++){
if (input[i] === vowels[j]) {
if (input[i] === 'e') {
resultArray.push('ee')
} else if (input[i] === 'u') {
resultArray.push('uu')
} else {
resultArray.push(input[i]);
}
}
}
}
console.log(resultArray.join("").toUppercase();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment