3 ms·
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 = funct
by tienthanh8490 11y ago
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