“Desembrowel Trolls” Respostas de código

Desembrowel Trolls

function disemvowel(str) {
  
  
   var vowels = ['a','e','i','o','u']
    let newStr = str.split('')
    .filter(el=>vowels.indexOf(el.toLowerCase()) ==-1)
    .join('')
     
     
     
     return newStr;
   }
ABS

Desembrowel 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
kouqhar

Respostas semelhantes a “Desembrowel Trolls”

Procure respostas de código populares por idioma

Procurar outros idiomas de código