编辑代码

function debounce(func, duration) {
  let timer = null;
  
  return function(...args){
  	let context = this;
    if(timer) clearTimeout(timer);
    timer = setTimeout(()=>{
    	func.apply(context.args);
    },duration)
  }
}