Reputation: 7882
In Chrome Dev Tools, you console.log
an Array. It shows: (4)[Location, Location, Location, Location]
: perfect, that's what I expected.
You click on it, to reveal the elements, and it shows:
How is this possible?
Upvotes: 1
Views: 493
Reputation: 7299
The console
will log the array
. You see three properties inside it. When you delete a property later on, and you open the console
. You will only see the remaining properties.
See this snippet, and check the console
in your browser.
var array = [{name: 'helle'}, {name: 'Google'}, {name: 'Bonjour'}];
console.log(array);
delete array[2];
Just a visualization of the anwser given by @Felix Gaebler
Upvotes: 1
Reputation: 743
This happens when the element is edited after it was logged. Chrome just shows you a pointer to that element. If 2 and 3 are removed after console.log()
they are shown in the preview, but not when you inspect the element.
Upvotes: 5