[Solved] how to remove matching elements in an array?


What you seem to need is

const nearButNotApplied = this.allJobsNear.filter(({
  _id: nearId
}) => !this.appliedJobs.some(({
  _id: appliedId
}) => appliedId === nearId));

Demo

const allJobsNear = [{
  _id: 1
}, {
  _id: 2
}, {
  _id: 3
}, {
  _id: 4
}]
const appliedJobs = [{
  _id: 3
}, {
  _id: 1
}]

const nearButNotApplied = allJobsNear.filter(({
  _id: nearId
}) => !appliedJobs.some(({
  _id: appliedId
}) => appliedId === nearId));

console.log(nearButNotApplied)

0

solved how to remove matching elements in an array?