Skip to content

filtering data with array of objects data es6

I am trying to filter array of objects with another array of objects.

var actualData = [{modifiedy: "USER", createdOn: "2021-03-18", id: 33 },{modifiedy: "USER", createdOn:"2021-03-18", id: 22},{modifiedy: "USER", createdOn: "2021-03-18", id: 36},  {modifiedy: "USER", createdOn: "2021-03-18", id: 11 }] 

var selectedItems = [33,22]

I need to return Items which are not include in actual Data.

I have tried using below function but I am getting undefined “some” error.

 const filtered = result.filter((p) => !p.checkedItems.some((a) => checkedItems.includes(;

I have searched a lot achieve my requirement but I didn’t any solution can some one help me to fix this issue.



Try this

 var filtered = actualData.filter(function (item) {
        return selectedItems.indexOf( === -1;
    console.log('filtered', filtered);