I have two distinct arrays of data objects, each containing multiple fields:
https://i.stack.imgur.com/tMM4l.png
https://i.stack.imgur.com/ScgPh.png
Here is an example of the data object array with the inclusion of the eventId
field.
https://i.stack.imgur.com/21Vbv.png
The annotateData object also contains a eventId
field that corresponds with those in the data object. I aim to identify which data element shares the same eventId
as found in the annotateData, and then combine the respective annotateData element with the corresponding data object element. Consequently, the output will consist of a data object with augmented annotateObject fields.
data: [{
0:{ annotateData fields + existing data fields} //if eventId matches
}]
Is there a more efficient approach to achieve this without iterating through the entire data object?