📜  循环数组 aeiou - Javascript 代码示例

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

代码示例1
const vowels = [];
const consonants = [];
s.split('').forEach(function(o) {
 if (['a','e','i','o','u'].indexOf(o) != -1) {
  vowels.push(o);
 } else {
  consonants.push(o);
 }
})
console.log(vowels.join('\n'));
console.log(consonants.join('\n'));
}