remove all of the vowels from the String

PHOTO EMBED

Wed Jun 15 2022 16:48:30 GMT+0000 (UTC)

Saved by @KhaledOghli #javascript #html

/*
* 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!')
content_copyCOPY

Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!". Note: for this kata y isn't considered a vowel.