Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@romarios1987
Last active June 23, 2022 06:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romarios1987/162d5fcea27832361ec28cd39f9867b8 to your computer and use it in GitHub Desktop.
Save romarios1987/162d5fcea27832361ec28cd39f9867b8 to your computer and use it in GitHub Desktop.
Disemvowel Trolls CODEWARS
// ! Disemvowel Trolls CODEWARS
//?Solution 1
function disemvowel(str) {
return (str || '').replace(/[aeiou]/gi, '');
}
//?Solution 2
function disemvowel(str) {
var vowels = ['a', 'e', 'i', 'o', 'u'];
return str
.split('')
.filter(el => vowels.indexOf(el.toLowerCase()) == -1)
.join('');
}
console.log(disemvowel('This website is for losers LOL!'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment