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

118
Views
Compare two arrays of objects and remove duplicates

I have 2 arrays:

const arrayOne = [
  { id: 1, name: "one" },
  { id: 2, name: "two" },
  { id: 3, name: "three" },
];
const arrayTwo = [
  { id: 2, name: "two" },
  { id: 3, name: "three" },
];

And I want the expected result in a new array:

const result = [
  { id: 1, name: "one" }
];

Im trying to use a method like filter, but I keep getting the same result (arrayOne)

const result = arrayOne.filter((element) => !arrayTwo.includes(element));

What is the best way to make it ?

about 4 years ago · Juan Pablo Isaza
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!