DEV Community

loading...

Discussion on: Daily Challenge #3 - Vowel Counter

Collapse
taillogs profile image
Ryland G
const vowelString = 'whatever vowel string';
const count = [...(vowelString.toLowerCase())].map((letter) =>  [...'aeiou'].includes(letter) ? 1 : 0).reduce((aggr, curr) => aggr + curr);
Collapse
blended_ideas profile image
Karthik RP

Cool., I didn't know we can use spread on a string. 👍🏻

Collapse
powerc9000 profile image
Clay Murray

[...'aeiou'].includes

Collapse
taillogs profile image
Ryland G

Fixed, thanks!

Collapse
gabriela profile image
Gabi

Hi, i loved this solution. Took me a bit to get my head around the use of reduce here and it's awesome. Thanks. I learned something nice today.