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

99
Views
get unique objects from 2 array of objects

I have 2 array of objects:

marketingCarriers: 
[
   {
     code: "AM"
     logo: "logo1.png"
     name: "AEROMEXICO"
   }
]

operatingCarriers: 
[
  {
    code: "DL"
    logo: "logo12.png"
    name: "DELTA"
  },
  {
    code: "AM"
    logo: "logo1.png"
    name: "AEROMEXICO"
  }
]

I want to make an array by comparing these two array of objects where I will put the unique objects from these 2 arrays. So the output will be:

newArray: 
    [
      {
        code: "DL"
        logo: "logo12.png"
      }
    ]

What should be the process?

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

0

    const operators = operatingCarriers.filter(operating =>
        marketingCarriers.some(marketing => marketing.code !== operating.code),
      );
    
      const hasUniqueCarriers =
        JSON.stringify(operatingCarriers) !== JSON.stringify(marketingCarriers);

{hasUniqueCarriers && operators.length > 0 && (
            <div className="flight__operating-carrier-info">
              <div>{I18n.t('components.flight_info.operated_by')}</div>
              <div className="flight__operating-carrier-list">
                {operators.map(carrier => (
                  <div>{carrier.name}</div>
                ))}
              </div>
            </div>
          )}
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!