Skip to content

Instantly share code, notes, and snippets.

@pmutua
Created February 21, 2017 13:16
Show Gist options
  • Save pmutua/d7471d057bc62c39be80f5d39dc37c4b to your computer and use it in GitHub Desktop.
Save pmutua/d7471d057bc62c39be80f5d39dc37c4b to your computer and use it in GitHub Desktop.
Simple function to remove vowels in a sentence
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