39
rated 0 times
[
43]
[
4]
/ answers: 1 / hits: 19708
/ 13 Years ago, tue, october 11, 2011, 12:00:00
Lets imagine function like this:
function foo(x) {
x += '+';
return x;
}
Usage of it would be like:
var x, y;
x = 'Notepad';
y = foo(x);
console.log(y); // Prints 'Notepad+'.
I'm looking for a way to create function that's chainable with other functions.
Imagine usage:
var x, y;
x = 'Notepad';
y = x.foo().foo().toUpperCase(); // Prints 'NOTEPAD++'.
console.log(y);
How would I do this?
More From » function