Javascript Array with empty slots are displayed as undefined in the console
Categories
(DevTools :: Console, defect, P3)
Tracking
(Not tracked)
People
(Reporter: laranda, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
20.84 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Steps to reproduce:
Create an empty array with the Array constructor.
Example :
Array(9)
Actual results:
In the console, the array is logged as :
Array(9) [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined ]
Expected results:
The array should be displayed as filled with empty values instead of undefined.
Example :
Array(9) [empty x 9]
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Thanks laranda. We have a way to handle empty slots in our code, so something broke somehow and wasn't caught by tests. I'll investigate
Comment 2•5 years ago
|
||
Looks like it was regressed by Bug 1565781.
Basically we now return an "undefined" grip ({type: "undefined"}
), instead of returning null
(which we implicitly then use for empty slots).
I think it's a good time to fix this properly, and return an adequate grip (e.g. {type: "emptySlot"}
) instead of this easy-to-miss null
.
Updated•5 years ago
|
Updated•3 years ago
|
Comment 3•3 years ago
|
||
looks like this has been fixed at some point
Updated•3 years ago
|
Description
•