remove the items in array which are present in another javascript

Solutions on MaxInterview for remove the items in array which are present in another javascript by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "remove the items in array which are present in another javascript"
Phineas
19 Oct 2019
1var myArray = [
2  {name: 'deepak', place: 'bangalore'}, 
3  {name: 'chirag', place: 'bangalore'}, 
4  {name: 'alok', place: 'berhampur'}, 
5  {name: 'chandan', place: 'mumbai'}
6];
7var toRemove = [
8  {name: 'deepak', place: 'bangalore'},
9  {name: 'alok', place: 'berhampur'}
10];
11
12
13
14myArray = myArray.filter(ar => !toRemove.find(rm => (rm.name === ar.name && ar.place === rm.place) ))