var cost = (function(){
var args = []; return function(){ console.log(arguments); if(arguments.length === 0){ console.log(11111); var money = 0; for(var i = 0, l = args.length; i < l; i++){ console.log(args); money += args[i]; } return money; }else{ console.log(22222); [].push.apply(args, arguments); console.log(args); } }}());