Debounce and Throttle in JS

Debounce and Throttle are techniques to control how many time we allow an event to occur. The difference between them is explained below with an example

Debounce

The Debounce technique allow us to “group” multiple sequential calls in a single one.

Throttle

Throttle guarantees the execution of the function regularly, at least every x milliseconds while the event is occurring.

Open console using F12 key to see the results

Software Engineer — Frontend