• + 0 comments
    function vowelsAndConsonants(s) {
      const vowels = ['a', 'e', 'i', 'o', 'u'];
      let vowelArr = [];
      let consonantArr = [];
    
      for (let i = 0; i < s.length; i++) {
        if (vowels.includes(s[i].toLowerCase())) {
          vowelArr.push(s[i]);
        }
        else {
          consonantArr.push(s[i]);
        }
      }
    
      for (let i = 0; i < vowelArr.length; i++) {
        console.log(vowelArr[i]);
      }
    
      for (let i = 0; i < consonantArr.length; i++) {
        console.log(consonantArr[i]);
      }
    }