Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

402
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!