I have two arrays of equal length, each does contain object data.
This is the example code of the first array ...
const array1 = [{
  key: '5',
  value: '550',
}, {
  key: '6',
  value: '750',
}];
And here is the code for the second one ...
const array2 = [{
  type: 'Job',
  status: 'Finished',
  key : '5',
}, {
  type: 'Ticket',
  status: 'Processing',
  key : '6',
}];
In order to further process my data I need an intersection of both arrays with their corresponding object items being merged. The result should look like this ...
[{
  key: '5',
  value: '550',
  type: 'Job',
  status: 'Finished',
}, {
  key: '6',
  value: '750',
  type: 'Ticket',
  status: 'Processing',
}]
What I have come up with so far is ..
array1.forEach(function (element) {
  array2.forEach(function (element) {
    return {
      type: 'Ticket',
      status: 'Processing'
    };
  });
});
I don't know how to create the expected result. How would a solution to my problem look like?
 
     
     
     
    