You are viewing a single comment's thread. Return to all comments →
O(n)
function vowelsAndConsonants(s) { let consonants = []; for (const char of s){ isVowel(char) ? console.log(char) : consonants.push(char); } consonants.forEach((consonant)=> { console.log(consonant) }) } function isVowel(char){ const vowelRegex = /^[aeiou]$/i return vowelRegex.test(char) }
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 →
O(n)