0

I'm trying to push some objects into an array.

This is done in a cursor loop in an 'onsuccess' function of a cursor search using indexedDB.

It uses continue() to iterate through the matching objects.

I'm pushing these onto an array with arrayname.push.

I am examining the finished array with a console.log(arrayname) outside this function and the array appears to contain 4 objects and yet has a length of zero. It also mentions a length of 4 and shows the object.

I have attached a picture which illustrates console.log(arrayname).

illustration on console.log(arrayname)

I'm not clear on what the log is telling me - where are those objects? The result I have is by clicking on the Array [ ] that appears in the console which is the logged result.

Thanks for any help in untangling this.

Moray

MorayJ
  • 537
  • 2
  • 8
  • Please post your code here :) – GibboK Jul 01 '16 at 12:22
  • The length of zero that you are seeing in `__proto__` is `Array.prototype.length` which is always `0`. But still, yes the array has a zero length when it is logged but will have contents when you inspect it. – Bergi Jul 01 '16 at 12:24
  • Great thanks all - sorry I didn't post code, was basically trying to make sense of the message. – MorayJ Jul 01 '16 at 13:21

0 Answers0