<script> function throttle (func, duration) { // duration 以秒计 let last return function () { let now = Date.now() if (last && (now - last) < duration * 1e3) return last = now func.apply(this, arguments) } } var aa = function(a,b){ console.log(a+b) } var aa = throttle(aa, 30) aa(2, 3)
</script>