Inconsistent data in Chrome Developer Tools

When debugging my Chrome extension, I see several times: enter image description here

On the one hand, the object header says Array(2), but on the other hand, when expanding the object, it is obvious that the array has only one element.

What is the source of this discrepancy? Is this a bug in the debugger, or is there really an additional element in the array (perhaps undefined?), Which for some reason is not displayed?

+4
source share
1 answer

This is because the item was removed from the array after console.log ().

Then you expanded the array.

Just try this on the chrome console:

var myArray = ['value1', 'value2'];
console.log(myArray);
myArray.pop();
Run codeHide result

myArray. , 2 .

, .

+6

Source: https://habr.com/ru/post/1685668/


All Articles