score:0

you can try

 const hometowncount = apicallresult.reduce((acc, it) => {
   acc[it.hometown] = (acc[it.hometown] || 0) + 1;
   return acc;
 }, {});

hope this helps.

score:0

after a quick search, i found out i was on the right track. i needed object.keys(hometown) and object.values(hometown) to put in chartjs for things to work. cheers


Related Query

More Query from same tag