简体   繁体   中英

Inconsistent data in Chrome Developer Tools

While debugging my Chrome extension I see the following multiple times: 在此输入图像描述

On the one hand, the title of the object says Array(2) , but on the other hand, when expanding the object, it's evident that the array has only one element.

What's the source of this discrepancy? Is this a bug in the debugger or is there really an extra element in the array (maybe undefined?) that's for some reason is not visible?

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

Then you have expanded the array.

Just try this on the chrome console:

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

Then expand the log of myArray . You will see only one entry, but the already logged line still show 2 entries.

The content of the array is fetched when you expand, they are not duplicated for the log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM