双水孙少安

Results 3 comments of 双水孙少安

function once(fn){ var a = 0; return function(){ if(a != 0)return "no effect"; a=1; fn.apply(this,arguments) } } logOnce = once(alert); logOnce("foo") ; logOnce("bar") ;

String.prototype.reverse = function(){ return Array.prototype.reverse.call(this.split("")).join("") };

Array.prototype.reverse = function(){ //代码实现写在这里,最后应该默认return this for(var i=0,len=this.length-1,initLen=this.length; i