//节流2functionthrottle(fun, delay =1000){let last, deferTimer;returnfunction(args){let that =this;let _args = arguments;let now =+newDate();if(last && now < last + delay){clearTimeout(deferTimer);
deferTimer =setTimeout(function(){
last = now;
fun.apply(that, _args);}, delay)}else{
last = now;
fun.apply(that, _args);}}}functionfn(){
console.log(111);}
button.onclick=throttle(fn,2000)