I am dealing with 2 arrays:
const history = [
{ type: 'change', old: 1, new: 2 },
{ type: 'change', old: 3, new: 4 },
];
const contents = [
{ id: 1, info: 'infor1' },
{ id: 2, info: 'infor2' },
{ id: 3, info: 'infor3' },
{ id: 4, info: 'infor4' },
];
The resulting array should be:
const detailHistory = [
{ type: 'change', old: { id: 1, info: 'infor1' }, new: { id: 2, info: 'infor2' } },
{ type: 'change', old: { id: 3, info: 'infor3' }, new: { id: 4, info: 'infor4' } },
];
I need help in creating detailHistory
without using a nested loop with history
and contents