Consider the following example
function doSomethingToAVariable(variable){
return variable + 1
}
function doSomethingToAVariableASecondTime(variable){
re
If you want to chain then you need to return the object instead which will contain the final value
function variableOperations( initialValue )
{
this.value = initialValue;
this.someOp1 = function(){ this.value += 1; return this; }
this.someOp2 = function(){ this.value += 2; return this; }
}
var a = new variableOperations(1); //new object
a.someOp1().someOp2();
alert(a.value); //alerts 4