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

128
Views
What is the most effective way to filter this array?

I have two arrays. My goal is to get a third array with users that exist in usersUpdated but do not exist in oldUsers. I know i have to apply multiple filters, but I do not know how.

   const oldUsers = [
     { name: 'Fede', id: 1 },
     { name: 'Marce', id: 2 },
  ];

   const usersUpdated = [
   { name: 'Fede', id: 1 },
   { name: 'Marce', id: 2 },
   { name: 'Ale', id: 3 },
   { name: 'Julian', id: 4 },
];


const expectedValue = [
  { name: 'Ale', id: 3 },
  { name: 'Julian', id: 4 }
 ];
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Convert arrays to objects, use names as keys & ids as values, delete keys of old obj from updated obj then convert the updated obj back to array.

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!