Closed Bug 688401 Opened 9 years ago Closed 7 years ago

Web Console displays "[null]" for [Object.create(null)]

Categories

(DevTools :: Console, defect)

9 Branch
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 23

People

(Reporter: bruant.d, Unassigned)

References

Details

< console.log( [Object.create(null)] )
> [null]

What is logged is not an array with one null element. It's an array with one object
this is pretty fringe. For whatever reason, Object.create(null) in the console is return null. |null| isn't extensible?
Status: NEW → RESOLVED
Closed: 8 years ago
Component: Developer Tools → Developer Tools: Console
Resolution: --- → WONTFIX
(In reply to Rob Campbell [:rc] (:robcee) from comment #1)
> this is pretty fringe. For whatever reason, Object.create(null) in the
> console is return null. |null| isn't extensible?
I don't understand what you mean here. In JavaScript, null is a value, very much like undefined.
Object.create(null) creates an object (with properties, etc.) which [[Prototype]] is null, so it's an object, so I think it should be logged differently than the null value to avoid the confusion.

When the console displays "[null]" for [Object.create(null)], it makes it undistinguishable from [null] (an array with one element which value is null). It may be fringe, but it's wrong and misleading when you actually use it.

I'm taking the freedom to reopen as I think the ambiguity the console creates is worth fixing.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Duplicate of this bug: 851240
Fixed indeed after Bug 783499.

Thanks :-)
Status: REOPENED → RESOLVED
Closed: 8 years ago7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 23
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.