diff --git a/snippets/throttle.md b/snippets/throttle.md index e919bab24..3b9801d36 100644 --- a/snippets/throttle.md +++ b/snippets/throttle.md @@ -24,7 +24,7 @@ const throttle = (fn, wait) => { fn.apply(context, args); lastTime = Date.now(); } - }, wait - (Date.now() - lastTime)); + }, Math.max(wait - (Date.now() - lastTime), 0)); } }; };