Last active
June 23, 2022 06:00
-
-
Save romarios1987/162d5fcea27832361ec28cd39f9867b8 to your computer and use it in GitHub Desktop.
Disemvowel Trolls CODEWARS
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
// ! 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