·· function throttle(fn,wait=3000){ let lastTime = Date.now(), timeFlag = null
return function(...args){
let current = Date.now()
clearTimeout(timeFlag)
if(current - lastTime >= wait){
fn.apply(this,args)
lastTime = current
}else{
timeFlag = setTimeout(()=>{
fn.apply(this,args)
lastTime = current
},wait)
}
}
}