“Désemmoirent les trolls” Réponses codées

Désemmoirent les 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

Désemmoirent les 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

Réponses similaires à “Désemmoirent les trolls”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code