We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 2: Loops
Day 2: Loops
Sort by
recency
|
766 Discussions
|
Please Login in order to post a comment
THIS IS MINE:
To add to the multiple solutions posted, this was my method:
function vowelsAndConsonants(s) {
}
Newby, doing things very slowly, but thouroughly. Method goes throught the string twice, Once for vowels, and second time for consonants.
function vowelsAndConsonants(s) { for (let x = 0; x < s.length; x++){ if(s[x]=='a' || s[x]=='e' || s[x]=='i' || s[x]=='o' || s[x]=='u'){ console.log(s[x]) } } for (let x = 0; x < s.length; x++){ if (s[x]!='a' && s[x]!='e' && s[x]!='i' && s[x]!='o' && s[x]!='u'){ console.log(s[x]) } } }