/*
* Solution 1
*/
const vowels = ['a','e','i','o','u']
function disemvowel(str) {
const text = str.split('');
const textWithoutVowels = text.filter(el => !vowels.includes(el.toLowerCase()))
return textWithoutVowels.join('')
}
disemvowel('This website is for losers LOL!"), "Ths wbst s fr lsrs LL!')
/*
* Solution 2
*/
function disemvowel(str) {
const noVowels = str.replace(/[aeiou]/gi, '');
return noVowels
}
disemvowel('This website is for losers LOL!"), "Ths wbst s fr lsrs LL!')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter