Reflect.type

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


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

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

```js
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