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

141
Views
¿Hay una mejor manera de iterar a través de

¿Cómo iterar de una mejor manera a través de A y B?

Estructura de datos A:

AbsatzNrSaetzeText: { [key: string]: string[] };

Estructura de datos B:

 AbsatzNrSaetzeText: Record<number, string[]>;

¿Hay una mejor manera de obtener ese valor?

 for (var i = 0; i < this.UI_Seiten.length; i++) { for (var j in this.UI_Seiten[i].AbsatzNrSaetzeText) { for (var k = 0; k < this.UI_Seiten[i].AbsatzNrSaetzeText[j.valueOf()].length; k++) { console.log(this.UI_Seiten[i].AbsatzNrSaetzeText[j.valueOf()][k]); } } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para objetos iterables (como matrices), no hay necesidad de hacer referencia al índice para iterar sobre los valores; for..of permite un código significativamente más limpio, al colocar el valor que se itera directamente en un identificador que se puede usar en bucles posteriores.

Use Object.values en lugar de for..in , ya que no le importa la clave del objeto, solo el valor.

 for (const seiten of this.UI_Seiten) { for (const arr of Object.values(seiten.AbsatzNrSaetzeText)) { for (const str of arr) { console.log(str); } } }
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!