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

297
Vistas
I can't understand why the log shows the array items, but the array itself is empty

I'm working on a Next.js project implementing a class using typescript, but I stumbled across this problem that I can't figure out what is going on. This is the console.log line:

console.log('💀', this, this._products, this._products[0], this._products.length);

but this is the result: enter image description here

note that the _products inside the object has 3 items, but the log shows an empty array with 3 items inside, the this._products[0] as undefined and the .length as 0.

I double check where the itens are pushed into the array and everything looks fine. What seems weird for me is the fact that the console shows the array as empty and with 3 items at the same time.

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