Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.3K
Vistas
TypeError: .for is not iterable / array[Symbol.iterator]().next().value is not iterable

Given this code:

let arr = await fetch(...).then(r => r.json());
for(let [a, b] of arr) {
  console.log(a, b);
}

What could cause the cryptic/unhelpful error message .for is not iterable in Chromium/Node.js? On Firefox the error message is instead Uncaught TypeError: arr[Symbol.iterator]().next().value is not iterable.

This confused me for a few minutes so I figure until they make these error messages more friendly it'd be helpful to have an SO question/answer for it. See answer below.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This error occurs because the array contains non-arrays - e.g. it may contain objects like this:

let arr = [{a:1, b:2}, {a:3, b:4}];

So the for/of code should look like this instead:

for(let {a, b} of arr) {
  console.log(a, b);
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda