archives

« Bugzilla Issues Index

#4393 — 19.1.1 The Object Constructor: incorrect and confusing description in the intro


In the introductory text of Section 19.1.1:

When called as a constructor it creates a new ordinary object. When Object is called as a function rather than as a constructor, it performs a type conversion.

That description is confusing as it makes a nonexistent distinction between invocation as constructor and as function. Moreover, when you invoke it as constructor passing, e.g., an exotic Array as argument, the resulting object is neither new, nor ordinary in contradicting the aforementioned description.


Possible reformulation:

The Object constructor behaves the same way when called as a function or as a constructor. When called with no argument or when used as a super-constructor, it creates a new object. Otherwise, it converts its argument to an object.