📜  LEARN JAVASCRIPTWhale Talk - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:58.042000             🧑  作者: Mango

代码示例1
input = "You Are All Wee Gillis";
vowels = ['a','e','i','o','u'];
whaleTalk = [];
input.split('').filter(v => vowels.includes(v.toLowerCase())).forEach(x => {
  if (x === 'e' || x === 'u') {
    whaleTalk.push((x + x));
  } else {
    whaleTalk.push(x);
  }
});
console.log(whaleTalk.join('').toUpperCase())    //  OUUAEEAEEEEII