“Disemvowel troll” Kode Jawaban

Disemvowel troll

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

Disemvowel troll

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

Jawaban yang mirip dengan “Disemvowel troll”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya