score:1

Accepted answer

Your problem is that there is no check, that the obj is found in data2 or not.Try the following:

data1.forEach(function(d) {
  var obj = data2.find(function(e) {
   return d.id === e.id
  });
  if(obj)
   d.status = obj.status;
});

Related Query

More Query from same tag