Created
March 4, 2021 16:22
-
-
Save alexcrist/51c62db3211c89590d13d2758cf1c644 to your computer and use it in GitHub Desktop.
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
function disemvowel(str) { | |
let noVowelStr = ''; | |
for (const letter of str) { | |
// Determine whether each letter is a vowel | |
const lowerCaseLetter = letter.toLowerCase(); | |
const isVowel = ( | |
lowerCaseLetter === 'e' || | |
lowerCaseLetter === 'i' || | |
lowerCaseLetter === 'o' || | |
lowerCaseLetter === 'u' || | |
lowerCaseLetter === 'a' | |
); | |
// If not a vowel, add the letter to the output string | |
if (!isVowel) { | |
noVowelStr += letter; | |
} | |
} | |
return noVowelStr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment