JSFiddle - React, Tailwind, and code Playground
JavaScript
let x = [{d1:'3'}, {d2:'4'}, {d3:'5'}];
let y = [{c1:'3'}, {c2:'4'}, {c3:'5'}];
// create a new list to store the objects we'll create
let z = [];
[x, y].forEach(array => {
// loop through the values for this line
for (i=0; i < array.length; i++) {
// handle case where we need to add more objects to our list
if (z.length <= i) z.push({});
// add new kay and value
z[i][Object.keys(array[i])[0]] = array[i][Object.keys(array[i])[0]];
}
});
console.log(z)