防抖函数

function debounce(fn,delay){

let timer = null;

return function (){
 clearTimeout(timer);
 timer = setTimeout(function(){
 fn.apply(this);
},delay)
 
}

}
原文地址:https://www.cnblogs.com/zqm0924/p/13817596.html