原题目:
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!”.
Note: for this kata y isn’t considered a vowel.
简单翻译就是:写一个函数,把字符串中的所有元音字母去掉,然后返回新的字符串。举例来说,给一个字符串"This website is for losers LOL!", 返回"Ths wbst s fr lsrs LL!"。
第一时间就想到了要用正则表达式替换所有的元音字母为空。
代码如下:
function disemvowel(str) {