-
-
Save codecademydev/e9772f2b0ca2964ba9870f8ff615ac20 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const input = 'a whale of a deal!'; | |
const vowels = ['a','e','i','o','u']; | |
const resultArray = []; | |
for(let inputIndex = 0 ; inputIndex < input.length ; inputIndex++){ | |
//console.log(`input is ${inputIndex}`); | |
if(input[inputIndex] === 'a'){ | |
resultArray.push(input[inputIndex]) | |
} | |
if(input[inputIndex] === 'e'){ | |
resultArray.push(input[inputIndex]) | |
} | |
for(let vowelsIndex = 0; vowelsIndex < vowels.length; vowelsIndex++){ | |
//console.log(`vowelsIndex is ${vowelsIndex}`); | |
if (input[inputIndex] === vowels[vowelsIndex]){ | |
console.log(input[inputIndex]); | |
resultArray.push(input[inputIndex]); | |
} | |
} | |
} | |
console.log(resultArray.join(' ').toUpperCase()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment