Nobody has actually explained why it doesn't work. If we look at the latest spec, the Object function is defined as follows:
19.1.1.1 Object ( [ value ] )
When Object function is called with optional argument value, the following steps are taken:
- If
NewTarget is neither undefined nor the active function, then
- Return ?
OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%").
- If
value is null, undefined or not supplied, return ObjectCreate(%ObjectPrototype%).
- Return !
ToObject(value).
The first step is the important one here: NewTarget refers to the function that new was called upon. So if you do new Object, it will be Object. If you call new ExtObject it will ExtObject.
Because ExtObject is not Object ("nor the active function"), the condition matches and OrdinaryCreateFromConstructor is evaluated and its result returned. As you can see, nothing is done with the value passed to the function.
value is only used if neither 1. nor 2. are fulfilled. And if value is an object, it is simply returned as is, no new object is created. So, new Object(objectValue) is actually the same as Object(objectValue):
var foo = {bar: 42};
console.log(new Object(foo) === foo);
console.log(Object(foo) === foo);
In other words: Object does not copy the properties of the passed in object, it simply returns the object as is. So extending Object wouldn't copy the properties either.