Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

301
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda