score:1

you can like so:

const array1 = [ 
  {handle: "handle1", title: "handle1"},
 {handle: "handle2", title: "handle2"},
 {handle: "handle3", title: "handle3"} ]

const array2 = [ 
  {handle: "handle1", checkbox: true},
 {handle: "handle2", checkbox: false},
 {handle: "handle3", checkbox: true} ]

const array3 = array1.map(({ handle, title }, idx) => ({handle, title, checkbox: array2[idx].checkbox}));
console.log(array3)

const array1 = [ 
  {handle: "handle1", title: "handle1"},
 {handle: "handle2", title: "handle2"},
 {handle: "handle3", title: "handle3"} ]

const array2 = [ 
  {handle: "handle1", checkbox: true},
 {handle: "handle2", checkbox: false},
 {handle: "handle3", checkbox: true} ]

const array3 = array1.map(({ handle, title }, idx) => ({handle, title, checkbox: array2[idx].checkbox}));
console.log(array3)

score:1

here we are the using map method and object.assign method to merge the array of objects by using id.

const array1 = [ 
  {handle: "handle1", title: "handle1"},
 {handle: "handle2", title: "handle2"},
 {handle: "handle3", title: "handle3"} ]
const array2 = [ 
  {handle: "handle1", checkbox: true},
 {handle: "handle2", checkbox: false},
 {handle: "handle3", checkbox: true} ]
 

  console.log(array1.map((item1,i)=>{
     if(array2.find(item2 => item2.handle === item1.handle)){
       return object.assign({},item1,array2.find(item2 => item2.handle === item1.handle))
     }
  }))

and you can do like this.

const array1 = [ 
  {handle: "handle1", title: "handle1"},
 {handle: "handle2", title: "handle2"},
 {handle: "handle3", title: "handle3"} ]
const array2 = [ 
  {handle: "handle1", checkbox: true},
 {handle: "handle2", checkbox: false},
 {handle: "handle3", checkbox: true} ]
 
 let mergedarray = array1.map(itm => ({
        ...array2.find((item) => (item.id === itm.id) && item),
        ...itm
 }));
 console.log(mergedarray)

score:1

const newarr = []
array1.map((item) => {
    const checkbox = array2.find(array2item => array2item.handle === item.handle).checkbox;
    newarr2.push({ title: item.title, handle: item.handle, checkbox })
});

score:1

const parsedarray = array1.map(el => {
  const extradata = array2.find(arr2el => arr2el.handle === el.handle)
  return {
    ...el,
    ...extradata
  }
})

result :

[
  { handle: 'handle1', title: 'handle1', checkbox: true },
  { handle: 'handle2', title: 'handle2', checkbox: false },
  { handle: 'handle3', title: 'handle3', checkbox: true }
]

score:4

something like this may work, not sure how much the data will change with the object name you want to combine.

const array1 = [ 
  {handle: "handle1", title: "handle1"},
 {handle: "handle2", title: "handle2"},
 {handle: "handle3", title: "handle3"} ]
 
 const array2 = [ 
  {handle: "handle1", checkbox: true},
 {handle: "handle2", checkbox: false},
 {handle: "handle3", checkbox: true} ]
 
 
 const newarr = array1.map(v => {
    let obj = array2.find(o => o.handle === v.handle)
  
  if(obj) {
    v.checkbox = obj.checkbox
  }
  return v
 })
 
 console.log(newarr)


Related Query

More Query from same tag