I have been struggling with this exercise for about an hour now, and I can't figure it out. Can someone please help me with this?
Here is the array that I retrieved from the database: View Base Array Image
let data = [
{
"name": "October : 2019",
"userName": "Katherine Diaz",
"newCases": 875,
"recover": 8
},
// more data here...
]
I would like to transform the data as follows for testing purposes. Here's a snippet of what I want to achieve: View Transformation Image
let transformedData = [
{
name: 'October',
user: ['Katherine Diaz', 'Belyini Cabral', 'Mercedes Perez', 'N/A'],
newCases: [/* random numbers */],
recovered: [/* random numbers */],
monthRecovered: /* random number */,
monthNewCases: /* random number */
},
// more transformed data here...
];
This seems a bit complex for me at the moment. I believe I need more understanding of data structures in this language. Could someone point me in the right direction and provide some steps to get started? Thank you.