Re: Determining what prototype should be used for an object

On 11/14/14, 12:00 PM, Allen Wirfs-Brock wrote:
>>    var x = new self[0].Array()
>>    w(isObjectFromGlobal(x, self[0]))
>>    x = Array.prototype.constructor.call(self[0])
>>    w(isObjectFromGlobal(x, self[0]))
>
> according to the ES6 spec.
>    new Array()
> and
>     Array.prototype.constructor.call(anything)
> both produce objects whose [[Prototype]] are in the same realm as Array.  So the answer should yield true, true.

No, because the quoted code is using two different Array constructors. 
To per ES spec "true, false" is correct.

-Boris

Received on Friday, 14 November 2014 17:34:00 UTC