Toby L.
Toby L.

Reputation: 371

Empty Array that Still Has Elements

After pushing multiple elements into an array and logging it, Chrome DevTools is telling me that it's empty. However, the console still its displays elements.

Here's a picture that describes what I'm saying: https://i.sstatic.net/iMv1y.jpg.

The first displayed array is the atypical array and the second array is just a normal array that I logged for comparison.

I'm at a complete loss as to what is happening here. How can I have an empty array with elements still inside of it? And why does the console say that the array has a length of 7 when it's empty.

If it makes any difference I'm using Cordova and the DevTools is on a page with Ripple.

Upvotes: 2

Views: 1055

Answers (1)

Ram
Ram

Reputation: 144689

That's because you log the array when it's empty. The console shows the live state of the object.

enter image description here

Upvotes: 4

Related Questions