Below is a data object that needs to be iterated through using JavaScript in order to extract one "value" field into an array for each unique date.
While I am able to retrieve all the data, my goal is to collect one value for each distinct date (ignoring the time component).
{
name: "test",
data: Array(200)
}
data: Array(200)
0: {
@id: "p23o"
code: "02"
dateTime: "2018-12-12T04:38:00Z"
value: -0.645
}
1: {
@id: "p453o"
code: "02"
dateTime: "2018-12-12T07:48:00Z"
value: -0.3645
}
2: {
@id: "p4423o"
code: "032"
dateTime: "2018-12-11T07:13:00Z"
value: -0.645
}
+ 198 more objects
The resulting array should contain one value per day. What is the correct way to iterate over this data and create the desired array? Are there any best practices or recommended methods for accomplishing this task?
Thank you for your help!