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

95
Views
Loop over complex array structures with best practice and lowest complexity

I am calling an API that returns

 [{
        Id:string,
        Value:string,
        Value2: 
          [{Id:string,Value3:string}] ,
 {
        Id:string,
        Value:string,
        Value2: 
          [{Id:string,Value3:string}] 
 }]

How do i loop over value 2 with lowest complexity and best approach in JS

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

0

I am not sure i understand your issue but you can simply map over your table items like that (assuming a variable called table holds your data):

table.map((item) => {
  console.log(JSON.stringify(item.Value2))
})

And if you want to loop over the values of Value2:

table.map((item) => {
  item.Value2.map((subitem) => {
    console.log(subitem.Value3)
  })
})
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!