Hi I have an array of objects such as this:
const data = [ {day: "Monday", to: "12.00", from: "15.00"}, {day: "Monday", to: "18.00", from: "22.00"}, {day: "Tuesday", to: "12.00", from: "22.00"}]
I need to make a new array from this existing one and have it like below. I know I need to use .map method to create a new array, but my knowledge beyond this is lacking. Really appreciate it if someone could guide me in the right direction please.
Example of new array I want:
const newArr = [{"Monday":[{"12.00", "15.00"}, {"18.00", "22.00"}], {"Tuesday": ["9.00", "5.00"]}]