I wrote script with Javascript below.
let names = [];
console.log(names); // shows length=10 after expanding
console.log(names.length); // shows 0
console.log(names.length === 0); // shows true
names.length = 10;
console.log(names); // behaves the same way as first log.
when it run in chrome, I see results in chrome devtools like below. enter image description here
The length of initial array is 0, but it display length is 10, why?
I think first console.log will show length of 0
I read MDM Array.length
Setting any array index (a non-negative integer smaller than 232) beyond the current length extends the array — the length property is increased to reflect the new highest index.