Where is it specified that new objects are empty, if it is?

Brendan Eich brendan at mozilla.com
Fri Mar 15 16:20:46 PDT 2013

Kevin Reid wrote:
> I'm doing a little maintenance on SES. Chrome has recently added a new
> odd behavior:
>> var o = Object.create(null);
>> Object.getOwnPropertyNames(o)
> []
>> Object.getOwnPropertyDescriptor(o, '__proto__');
> Object {value: null, writable: true, enumerable: false, configurable: false}

Oh come on! :-P

> The two results are clearly non-conformant, in that gOPN and gOPD
> should be consistent with each other. However, the problem that I'm
> wanting to record accurately is the fact that Object.create(null) has
> (however inconsistently) any properties at all (thus interfering with
> table-like uses).

ES6 will specify __proto__ as "own" and configurable in 
Object.prototype. Whether magic data or accessor with censored or 
poisoned getter and setter I'm not sure at the moment, but the above 
will definitely not conform to ES6.

> Object.create refers to which specifies “a newly
> created native ECMAScript object”. Where is the initial state of the
> collection of properties of a “newly created” object specified? (8.6
> defining the Object type doesn't say anything about the existence of
> non-internal properties.)

Whoa, spec hole. Allen?

> (I recognize that this behavior may well be a deliberate variance to
> reconcile __proto__ and ES5/ES6. This is not a complaint; this is a
> request to consult spec-lawyers.)

Ok, whew. Sorry for lawyering,


More information about the es-discuss mailing list