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

137
Views
Javascript convert Object.keys to destructuring vars of other object

Is there a way to convert Object.keys to vars can be destructured for other object ?

So if I have

let ob1 = { key1: 'value', key2: 'value2'}
let dictionary = { key1: 'super value', key2: 'other value' }

can do this

let { Object.keys(ob1) } = dictionary
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use Object.assign and map()

let ob1 = { key1: 'value', key2: 'value2'}
let dictionary = { key1: 'super value', key2: 'other value' }

let res = Object.assign(...Object.keys(ob1).map(key => ({ [key]: dictionary[key] })));
console.log(res);

{
  "key1": "super value",
  "key2": "other value"
}
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!