Sg2.9
Chaining Constructors
Recent RSS
Chaining Constructors
From:  Jay Weeks
Date:  6. September 2011, 02:46

Not sure why, but when trying to chain constructors with call() or apply(), nothing happens.https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/call

i.e. extending the Point object :

function PointW( x, y, w ) {
	Point.call( this, x, y ); //call the Point constructor for this object

	this.weight = w; //set additional values
}
PointW.prototype = new Point(); //inherit Point methods/vars
Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Themed colours 06.08.12