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

81
Visualizações
Array is returning undefined even though it has variables stored

When I try "console.log" the whole array it shows, but when I try array.length or array[0] it is returning undefined and an empty array. I am pushing strings into an array from a Json file. In the screen shot below is the difference when logging a normal string array and my array which i think is the reason this is happening but I cant figure out how to fix it enter image description here

Here is some of the thing that is not making sense for me

console.log(posts2); // returns 0: "Day #50" 1: "Ramadan Kareem" 2: "Freedom" 3: "Elife Unlimited" 4: "Wasel Gifts" length: 5

console.log(posts2.slice(0,2)); // returns empty array

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