Last active
February 21, 2017 13:11
-
-
Save brianmarete/47f7ff2fa0699779e0496afea0e20348 to your computer and use it in GitHub Desktop.
A JavaScript function to receive a sentence and return a copy of the sentence without vowels.
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 removeVowels(sentence) { | |
var vowels = ['a', 'e', 'i', 'o', 'u']; | |
var newSentence = []; | |
for (var i = 0; i < sentence.length; i++) { | |
if (vowels.includes(sentence[i])) { | |
newSentence.push('-'); | |
} else { | |
newSentence.push(sentence[i]); | |
} | |
} | |
return newSentence.join(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment