Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Disemvowel Trolls

// 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!".

function disemvowel(str) {
  let regExp = /[^aeiou]/gi
  let troll = str.match(regExp)
  return troll.join('');
}
console.log(disemvowel("This website is for losers LOL!"))

// With love @kouqhar
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #Disemvowel #Trolls
ADD COMMENT
Topic
Name
6+5 =