Serenity Operating System
at hosted 26 lines 463 B view raw
1try { 2 function Foo() { 3 this.x = 123; 4 } 5 6 var foo = new Foo(); 7 assert(foo instanceof Foo); 8 9 function Base() { 10 this.is_base = true; 11 } 12 13 function Derived() { 14 this.is_derived = true; 15 } 16 17 Object.setPrototypeOf(Derived.prototype, Base.prototype); 18 19 var d = new Derived(); 20 assert(d instanceof Derived); 21 assert(d instanceof Base); 22 23 console.log("PASS"); 24} catch(e) { 25 console.log("FAIL: " + e); 26}