Batman era gay.
E il seguente codice funziona:
C'è da dire che effettivamente setter diventa del tutto inutile e lo si può eliminare, a meno di non fare un "ritocchino":codice:var Foo = new function() { this.name = null; this.setter = (function() { this.name = "jack"; }).call(this); }; alert(Foo.name);
Codice PHP:var Foo = new function() {
this.name = null;
(this.setter = function() {
this.name = "jack";
}).call(this);
/*Che è lo stesso di:
this.setter = function() {
this.name = "jack";
};
this.setter();
*/
};

Rispondi quotando