//节流2 functionthrottle(fun, delay = 1000) { let last, deferTimer; returnfunction (args) { let that = this; let _args = arguments; let now = +newDate(); if (last && now < last + delay) { clearTimeout(deferTimer); deferTimer = setTimeout(function () { last = now; fun.apply(that, _args); }, delay) } else { last = now; fun.apply(that, _args); } } }