编辑代码

function debounce (fn, wait) {
    let timer
    return function(){
        let context = this;
        let args = arguments;
        clearTimeout(timer)
        timer = setTimeout(function (){
            fn.apply(context,args)
        }, wait)
    }
}

function print() {
    name = 'Sharlok'
    movie = { name: 'Spider Man' }
    console.log(new Date())
    console.log('print ' + this.name);
}
console.log(11)

const newfunc = debounce(print, 1000);
newfunc()