I have two classes:
class Bar extends Foo { // Foo isn\'t relevant constructor(value) { if (!(value instanceof Foo)) throw \"InvalidArgumentException:
You should test if value's internal [[Prototype]] is exactly Foo.prototype. You can get the internal [[Prototype]] with Object.getPrototypeOf :
value
[[Prototype]]
Foo.prototype
if ( Object.getPrototypeOf( value ) !== Foo.prototype ) throw "InvalidArgumentException: (...)";