Q:

Array groupby and count

I am trying to get day wise count from below data 
example:
{ 'Tue Oct 01 2019': 3, 'Tue Oct 02 2019': 1 }
But I'm not getting the expected result from the below code.

const data = [ { Date: 'Tue Oct 01 2019' },{ Date: 'Tue Oct 01 2019' },{ Date: 'Tue Oct 01 2019' }, { Date: 'Tue Oct 02 2019' } ];

const result = data.reduce((total, value) => {
  total[value] = (total[value] || 0) + 1;
  return total;
}, {});
console.log(result);

A:

If I understood you correctly, what you want is to group and get count:
const data = [ 
    { Date: 'Tue Oct 01 2019' },
    { Date: 'Tue Oct 01 2019' },
    { Date: 'Tue Oct 01 2019' }, 
    { Date: 'Tue Oct 02 2019' } 
];

const result = data.reduce((total, {Date}) => {
    total[Date] = (total[Date] || 0) + 1;
    return total;
  }, {});
console.log(result);

