DEV Community

Discussion on: JavaScript Programming Problem 2

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited
const vowelCount = s=>[...'aeiou'].reduce(
   (a,x)=>(c=(s.match(new RegExp(x,'gi'))||[]).length,{...a,...c&&{[x]:c}}),{}
)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
hijazi313 profile image
Muhammad Hamza Hijazi • Edited

Perfect <3