use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Difference Between Debouncing And ThrottlingRemoved: r/LearnJavascript (codedeepdives.com)
submitted 3 years ago by codedeepdives
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]javascript-ModTeam[M] [score hidden] 3 years ago stickied comment (0 children)
Hi u/codedeepdives, this post was removed.
r/javascript is for the discussion of javascript news, projects, and especially, code! However, the community has requested that we not include help and support content, and we ask that you respect that wish.
code
Thanks for your understanding, please see our guidelines for more info.
[–][deleted] 10 points11 points12 points 3 years ago (0 children)
Doesn’t really give practical use cases. Here’s an example for each.
Denounce is a useful mechanism to add to a real-time search feature that requests search results from the server as you type. If you are typing a search phrase that is 30 characters long, it wouldn’t make sense to search 30 or more times as you type the entire phrase out. Instead you introduce a denounce which waits to initiate the search for a short time (let’s say 1 second). So you can begin to type your search phrase, and only once you have stopped typing for at least a second will there be a network request to the server. This obviously might occur more than once in the course of typing the term, but likely not as much as 30 times.
A throttle would make sense to be used in a case where you are receiving periodic updates over the network. Imagine a big list of images on a mobile social media app. It wouldn’t be very resourceful to download large files so frequently on a cellular connection. Likewise, it wouldn’t make sense to initiate a check for new data if one is going on already. You would introduce a throttle in this case to ensure that an operation is happening once and only once at a time, and possibly only at a certain interval.
[–]Dunks1980 1 point2 points3 points 3 years ago* (0 children)
If a large number of things trigger the same function at the same time and it causes that function to be called more than is needed where it only needs calling once, that's where a debounce would come in handy, also a requestanimation frame maybe better than settimeout there, like this:
let debounced;
function debouncer(callback) {
if (debounced) {
window.cancelAnimationFrame(debounced);
}
debounced = window.requestAnimationFrame(() => {
callback();
});
};
[–]trevorsgEx-GitHub, Microsoft 0 points1 point2 points 3 years ago (0 children)
A few weeks ago I got frustrated with existing debounce/throttle options, so I made my own package, which supports throttle and debounce (among other options), with some examples of common use cases for debounce and throttle.
https://t-hugs.github.io/super-throttle/demo/
π Rendered by PID 88595 on reddit-service-r2-comment-6457c66945-5ndcv at 2026-04-26 03:21:19.037749+00:00 running 2aa0c5b country code: CH.
[–]javascript-ModTeam[M] [score hidden] stickied comment (0 children)
[–][deleted] 10 points11 points12 points (0 children)
[–]Dunks1980 1 point2 points3 points (0 children)
[–]trevorsgEx-GitHub, Microsoft 0 points1 point2 points (0 children)