ladybird/Libraries/LibJS/Tests/operators/instanceof-basic.js
2020-07-03 19:30:13 +02:00

28 lines
488 B
JavaScript

load("test-common.js");
try {
function Foo() {
this.x = 123;
}
var foo = new Foo();
assert(foo instanceof Foo);
function Base() {
this.is_base = true;
}
function Derived() {
this.is_derived = true;
}
Object.setPrototypeOf(Derived.prototype, Base.prototype);
var d = new Derived();
assert(d instanceof Derived);
assert(d instanceof Base);
console.log("PASS");
} catch(e) {
console.log("FAIL: " + e);
}