Filter array of objects with another array of objects

前端 未结 9 1787
小蘑菇
小蘑菇 2020-11-27 05:18

This question is similar to this one Jquery filter array of object with loop but this time I need to do the filter with an array of objects.

Exemple:

I have

9条回答
  •  醉话见心
    2020-11-27 06:08

    In response to Andy answer above, which I believe should be marked now as answer., if you are looking for exact opposite behavior, use every with negation, something like this.

    const result = masterData.filter(ad => 
                 filterData.every(fd => fd.userid !== md.userid));
    

    result contains all masterData except filterData.

提交回复
热议问题