constructor - Javascript function() literal overloading -


I was always curious, there is a possibility to load the surcharge with the function, as you can with the function:

  var test = function; Function = function (arg) {warning ('test'); Return Examination (RGR); } Var b = function ("alert ('a')"); Var c = function ("alert ('x')"); B (); C();  

Of course you can guess that this is a good way to debug the whole project. However, whatever efforts I have made is nothing.

The question for you is that:

  1. Maybe there is something that I do not know, maybe there is the possibility of surrender to the damn constructor? (But probably not). If not, then - how is it possible - if it is possible - any browser (not just using JavaScript but their expanded language - every browser has found something like this).
  2. If not - how is it used to add trough like firebug or etc ??

You terminology is closed: function () function < Em> constructor , while function () {...} is a function literally .

No more, I do not think there is a portable way to do this, but it may be for older versions of Firefox: if I remember correctly, it can be used once With the () {...} built in, the underlying creator will use shadows and Firefox will also use new ones for the literal use.

It does not work anymore:

  var overload = {object: function () {}}; Overload.Object.prototype.foo = 'Bar'; (Surcharge) with {document.writeln (new object (.foo); Document.writeln ({} foo.); }  

Comments