How to identify differences?

  • 0
    There are two arrays of objects.

    The object has one property

    How to get an array of objects as a result
    for example, one array does not have one object, it must be the result

    var arr1 = [{ 'x': 1}, { 'x': 2 }];
    var arr2 = [{ 'x': 1}];
     
    console.log(diff);
    // [{ 'x': 2 }]
    JavaScript Everly Nicholson, Jul 9, 2020

  • 1 Answers
  • 0
    What is the problem to write the same thing in Google? Or do you think no one has come across this before you?

    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];

    _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
    // => [{ 'x': 2, 'y': 1 }]




    https: // www .google.com / search? sxsrf = ALeKk02l52Bg77 ...
    Ella Gray

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!