Difference Between Debouncing & Throttling in JavaScript
There are some key differences between throttling and JavaScript as listed in the below table:
Debouncing |
Throttling |
---|---|
It is used to delay the execution of a function if it is called continuously. |
It limits the invocation of a function by invoking it after a certain interval of time if it is called continuously. |
It is used to handle events that fire quickly like user input. |
It is mainly used with the scroll or resize events to limit the frequency of function calls. |
It clears the previous timer on each function call and sets a new one every time |
It maintains a constant limit between the invocation of two function calls. |
Contact Us