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

111
Views
Loop object with an object

How can I loop my object inside an object? I have an address object inside of a person object. I can iterate the key and value of a person object.

let obj = {
  name: 'John Doe',
  age: 23,
  gender: 'Male',
  address: {
    street: 'SampleStreetName',
    province: 'SampleProvinceName',
    city: 'SampleCityName',
  },
};

Object.keys(obj).forEach((key) => {
  console.log(`${key}: `, obj[key]);
});

I want my output like this:

name:  John Doe
age:  23
gender:  Male
street: SampleStreetName 
province: SampleProvinceName 
city: SampleCityName

This is my actual output:

name:  John Doe
age:  23
gender:  Male
address:  {street: 'SampleStreetName', province: 'SampleProvinceName', city: 'SampleCityName'}
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!