I have the following values -
const r = [{ id: 2, car: 'toyota}, {id: 1, car:'honda'}]
const s = [{ id: 2, name: 'Samuel'},{id: 1, name: 'James'}]
I want to match the arrays based on id and add name to each corresponding matched object id.
const res = [{id: , car: , name: }]
I have certain values I need to map together to make into one response object, so it needs to be an array of objects with various properties. I want to map based on an id and then loop through each object in the array and add the corresponding object. Kindly help, much appreciated!