Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #7977
| From | 4ndre4 <4ndre4@4ndre4.com.invalid> |
|---|---|
| Newsgroups | it.comp.lang.javascript |
| Subject | Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() |
| Date | 2016-01-24 13:56 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <n82l23$bti$1@dont-email.me> (permalink) |
| References | <12069110-6044-4930-9e22-4304304ea799@googlegroups.com> |
On 23/01/2016 21:17, alcaseltzer wrote:
> Ora avrei bisogno di concatenare alcune funzioni per operare in maniera gerarchica.
Cioe` vuoi creare qualcosa di "chainable" simile al seguente?
function YourObject() {
this.yourText = "hello";
};
YourObject.prototype.doSomething = function() {
this.yourText += ", I've done something";
return this;
};
YourObject.prototype.doSomethingElse = function() {
this.yourText += ", I've done something else";
return this;
};
YourObject.prototype.getText = function() {
return this.yourText;
};
var yourObject = new YourObject();
console.log(yourObject.getText());
yourObject.doSomething().doSomethingElse().doSomething().doSomethingElse();
console.log(yourObject.getText());
--
4ndr4
"The use of COBOL cripples the mind; its teaching should, therefore, be
regarded as a criminal offense." (E. Dijkstra)
"Ora, questo "Delta11" non è nulla di più di uno scemo del
villaggio[...]" - http://goo.gl/1nrkkX
Back to it.comp.lang.javascript | Previous | Next — Previous in thread | Find similar
oggetto.nomeFunzione("stringa").operaSullaFunzione() alcaseltzer <albaserver@gmail.com> - 2016-01-23 13:17 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() Alessandro Pellizzari <shuriken@amiran.it> - 2016-01-24 06:59 +0000
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() albaserver@gmail.com - 2016-01-24 02:06 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() albaserver@gmail.com - 2016-01-24 02:26 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() Alessandro Pellizzari <shuriken@amiran.it> - 2016-01-24 13:33 +0000
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() albaserver@gmail.com - 2016-01-24 05:48 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() Alessandro Pellizzari <shuriken@amiran.it> - 2016-01-24 14:14 +0000
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() albaserver@gmail.com - 2016-01-24 06:28 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-01-24 14:52 +0000
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() Alessandro Pellizzari <shuriken@amiran.it> - 2016-01-24 15:50 +0000
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() albaserver@gmail.com - 2016-01-24 10:45 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-01-24 19:08 +0000
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() albaserver@gmail.com - 2016-01-24 12:33 -0800
Re: oggetto.nomeFunzione("stringa").operaSullaFunzione() 4ndre4 <4ndre4@4ndre4.com.invalid> - 2016-01-24 13:56 +0000
csiph-web