You just need to "return this;" for the methods whose result need to be chained.
Example:
var a = function(x){ this.x = x+1; return this; }
var b = function(){ this.x *= 2; return this.x; }
a(3).b(); //result = 8
Example:
var a = function(x){ this.x = x+1; return this; }
var b = function(){ this.x *= 2; return this.x; }
a(3).b(); //result = 8
No comments yet.