You are viewing a single comment's thread. Return to all 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]); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Loops
You are viewing a single comment's thread. Return to all comments →