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

271
Views
JS: merge array of objects when different key

I'm looking for a smart way to merge array of objects when they have different keys. "Smart" here I mean, you can use for loop for example to push or concat objects to create the desired object, but here I'm looking for a shorter way (like using map or such) if possible.

The below is an example of the array of objects where each object have different key.

[
    {
        privacy: true
    }, 
    {
        date: true
    }
]

From the above, the desired result would be like this below.

{
    privacy: true,
    date: true
}

So what can I implement smartly (but not for loop or a redundant way) to do this? Thanks for your help.

about 4 years ago · Santiago Trujillo
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!