I'm trying to solve this little problem, where I need to use reduce to create an object with the counts of each item.
I thought I understood how reduce works, using a function to get multiple values down to one, yet I cannot figure out how this is to work.
Any ideas or advice? I really appreciate it.
// var people = ['josh', 'dan', 'sarah', 'joey', 'dan', 'josh', 'francis', 'dean'];
// can reduce be used to get:
// {
// josh: 2,
// dan: 2,
// sarah: 1,
// joey: 1,
// francis: 1,
// dean: 1
// }