Re: Determining what prototype should be used for an object

On Nov 14, 2014, at 9:33 AM, Boris Zbarsky wrote:

> 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.

Ah, right.  I wasn't exactly sure what self was, but I was assuming that self[0]j.Array was the same as Array

Allen

Received on Friday, 14 November 2014 17:39:36 UTC