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

411
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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