Visit Mozilla.org

Talk:Core JavaScript 1.5 Reference:Global Objects:Function:prototype

From MDC

I'm chaning {{NeedsTechnicalReview}} to {{NeedsContent}} because I'm pretty sure everything here is technically correct, and the only comment in the document history is that there should be a link to a description of the JavaScript object model. FWIW, I agree with the request. JulesH 13:13, 1 August 2006 (PDT)

[edit] Single Extenstion

If your looking to extend just a single function similar to most other languages extends and not all the functions instances, then use this.--Seant23 14:14, 21 August 2006 (PDT)

Only Properties (this.*) will be extended

 var a = function()
 {
	this.food='pizza';
 }

 var b = function()
 {
	this.extension=a;
	this.extension();
	delete this.extension;
 }

 var myObj = new b();
 alert(myObj.food); //Alerts Pizza
This advice needs to be cleaned up a bit (in particular you can use Function.prototype.apply instead of the this.extension trick), and I'm not sure it belongs on this page. --Nickolay 04:14, 25 August 2006 (PDT)