function adder( me ) {
var slice = Array.prototype.slice, args = slice.call(arguments);
return function () {
var inargs = slice.call(arguments);
if( arguments.length == 0 ){
var me = 0 ;
for(var i in args){
me +=args[i];
}
return me ;
}
else return adder.apply(this, args.concat(inargs));
};
}alert( adder(1)(2)() );
网友评论