A Chain adding function code example
Example: A Chain adding function
function add(n){
// Let the currying begin!
var currentSum = n;
function addF(b) {
currentSum += b;
return addF;
}
addF.toString = function() {
return currentSum;
};
return addF;
}