score:2

Accepted answer
.as-console-wrapper { max-height: 100% !important; top: 0; }

score:1

const outputArr = array1.reduce((acc, nxt) => {
  const {id, family, featuredImage} = nxt.node;
  const newObj = {id, family, featuredImage, games: []};
  const array2Match = array2.filter(obj => obj.node.family === family);

  if(!!array2Match.length) {
    newObj.games.push(array2Match[0]);
  }
  acc.push(newObj)
  return acc;
}, []);


console.log(outputArr);

Related Query

More Query from same tag