编辑代码

function debounce(fn,wait){
    let timer = 0;
    return function(...args){
        let now = new Date()
        if(now - timer>wait){
            fn(...args)
            timer = now
        }
    }
}

let conso = function (){
    console.log(111)
}

let debouncefn = debounce(conso,2000)

window.addEventListener("click",debouncefn)