DEV Community

Discussion on: What’s your alternative solution? Challenge #57

Collapse
 
miketalbot profile image
Mike Talbot ⭐
   const count = str=>Object.entries(str.split('').reduce((c,a)=>(c[a] = (c[a] || 0) + 1, c), {})).map(([chr,count])=>({chr,count}))