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

299
Views
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
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!