Thaddee Tyl thaddee.tyl at
Mon Jun 8 14:05:28 UTC 2015

On Sat, Jun 6, 2015 at 6:23 PM, Jordan Harband <ljharb at> wrote:
> if `class SubThing extends Thing {}`, then `new SubThing instanceof Thing`
> would be true.

Ah! Good. I expected it to fail just like this:

function Thing(){}
function SubThing(){}
SubThing.prototype = Object.create(Thing)
SubThing.prototype.constructor = Thing
Object(new SubThing) instanceof Thing  // false

> Based on your isA examples, `Object(foo) instanceof bar` should be reliable
> within a single realm, and works everywhere, without the need for a new
> builtin method.

I can't think of a way to make something work across realms, so that's
indeed the best we have got.

More information about the es-discuss mailing list