In today's video we'll be talking about the difference between debounce and throttle. These functions often get mixed up, and while they both serve a similar purpose, they're also quite different.
First, let's go over what they have in common. Both debounce and throttle act as flood gates between events and event handlers. They're useful when you want to execute an expensive operation, such as a DOM query or an API request, based on a mostly continuous trigger such as mousemove or scroll.
We'll go over how each one of them works, and then explore a common use case for when you should use one over the other.