I have two arrays of type
var members = [{docId: "1234", userId: 222}, {docId: "1235", userId: 333}];
var memberInfo = [{id: 222, name: "test1"}, {id: 333, name: "test2"}];
I need to combine this with a single array programmatically matching user IDs
The final array should be like
var finalArray = [{docId: "1234", userId: 222, name: "test1"}, {docId: "1235", userId: 333, name: "test2"}]
Is there a cleaner way to do this, I have an underscore library in my application, but I could not find a clean method to achieve this
Prats source
share