Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
comparing different values of two arrays and returning one filtered array in JavaScript

I am trying to compare the values of two different arrays, if the user.id of the volunteer iteration matches the id of the userVolunteer iteration, I want that entry to be filtered out of the volunteers array

current attempt:

  const newBirds = volunteers.filter((volunteer) => {
    return volunteer.user_id !== userVolunteers.some((vol) => vol.id)
  });

newBirds currents returns the volunteers array without filtering any of the entries? Any advice?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to put the logic of comparison inside the some callback:

const newBirds = volunteers.filter((volunteer) => {
  return userVolunteers.some((vol) => volunteer.user_id !== vol.id)
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!