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

84
Views
Equivalent of item for Object.entries

I am using Object.entries because I want to use the key and value but I also want access to the whole item. Is it possible to get the parent of key and value as well?

const object1 = {
  a: 'somestring',
  b: 42
};

for (const [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
  // How to get the parent of key and value ie [key, value];
}

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

0

Destructure in the first line instead?

const object1 = {
  a: 'somestring',
  b: 42
};

for (const entry of Object.entries(object1)) {
  const [key, value] = entry;
  console.log(`${key}: ${value}`);
  console.log(entry);
}

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!