SOURCE

'use strict';
let a = 1
function debounce(func, delay) {
    let timer;
    return function(...arg) {
        clearTimeout(timer)
        timer = setTimeout(()=>{
            func.aplly(this,arg)
        },delay)
    }
}
const log = debounce(()=>console.log(a),1000)

log()
log()
console 命令行工具 X clear

                    
>
console