5 console.log('Base here', this.x, this.y);
\r
8 Base.prototype.echo = function()
\r
10 console.log('Base echo here', this.x, this.y);
\r
13 function Derived(x, y, z)
\r
15 console.log('calling base');
\r
16 Base.call(this, x, y);
\r
17 console.log('base called');
\r
19 console.log('Derived here', this.x, this.y, this.z);
\r
22 Derived.prototype = new Base; // Base constructor null null is called
\r
23 Derived.prototype.base = Base.prototype;
\r
25 Derived.prototype.echo = function()
\r
27 this.base.echo.call(this);
\r
28 console.log('Derived echo here', this.x, this.y, this.z);
\r
31 var t = new Derived(10, 20, 30);
\r
32 console.log('init complete');
\r
34 Derived.constructor.toSource();
\r
36 console.log(t instanceof Base); // true
\r
37 console.log(t instanceof Derived); // true
\r