“Abnutzungstrolle” Code-Antworten

Abnutzungstrolle

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

Abnutzungstrolle

// 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

Ähnliche Antworten wie “Abnutzungstrolle”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen