Skip to content

Commit 7151add

Browse files
chore:Add comment to explain throttling behavior in scroll event handler
1 parent 13f8243 commit 7151add

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: snippets/javascript/function-utilities/throttle-function.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const throttle = (func, limit) => {
1818
};
1919

2020
// Usage:
21+
// Ensures the function can only be called once every 1000 milliseconds
2122
const logScroll = throttle(() => console.log("Scroll event triggered"), 1000);
2223

2324
// Attach to scroll event

0 commit comments

Comments
 (0)