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

401
Vistas
The Array is full of objects but it isnt?

I've written some code and it all worked the news are getting displayed but when i try to work with one of the news it says its undefined

console.log(news);
console.log(news[0]);

image of the output

even the length of the news is 0

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are seeing a case of the dev tool evaluation being lazy. The output you are seeing in your console is the value of the array when you click on it, not when it was logged.

You can see it for yourself by doing:

console.log(news.length); // == 0
// Wait 2 seconds
setTimeout(() => {
  console.log(news.length); // != 0
}, 2000)

Your news array is empty at the time of the console log.

about 4 years ago · Juan Pablo Isaza 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