简体   繁体   中英

Js Chrome dev tools prints Array with length but no children

You can see in the screenshot that all three Arrays has lengths, but no children. Why that happens? Is it because Garbage collection hasn't collected and space for items is still reserved?

在此处输入图片说明

What version of chrome are you on? It is likely you have an empty array of size 10.

var test = {
    myArray: new Array(10)
};

console.log(test)

This results in an array of length 10 but the items are not initialized. In some versions of chrome, for example you could not use the map function on an uninitialized array.

I use Chrom 76 also. In my console it give me the info empties

在此处输入图片说明

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