This is the code:
var Event=(function(){ var clientList={},listen,trigger,remove; listen=function(key,fn){ /*some code*/ }; trigger:function(){ var key=Array.prototype.shift.call(arguments); fns=clientList[key]; if(!fns||fns.length==0){ return false; } for(var i=0,fn;fn=fns[i++];){ fn.apply(this,arguments); } }; remove:function(key,fn){ var fns=clientList[key]; if(!fns){ return false; } if(!fn){ fns&&(fns.length=0) }else{ for(var l=fns.length-1;l>=0;l--){ var _fn=fns[l]; if(_fn===fn){ fns.splice(1,1); } } } }; /*some code*/ })(); I could not understand why var key=Array.prototype.shift.call(arguments); instead of passing in arguments and fns&&(fns.length=0) instead of fns.length=0? I will highly appreciated if you could respond to my question.