Can someone please guide me on how to use the reduce array method to sort entries by date in the following data:
const entries = [
{date: 'lu'},
{date: 'lu'},
{date: 'ma'},
{date: 'ma'}
]
I would like the output to show the count of each date occurrence as follows:
const data = [
{x: 'lu', y: 2},
{x: 'ma', y: 2},
{x: 'me', y: 0},
{x: 'je', y: 0},
{x: 've', y: 0},
{x: 'sa', y: 0},
{x: 'di', y: 0},
]
Any assistance will be greatly appreciated. Thank you :)