TIL the difference between throttling and debouncing
POSTED ON:
TAGS: javascript events
I always get these two confused.
Throttling
enforces a maximum number of times a function can be called over time. As in “execute this function at most once every 100 milliseconds.”
A easy way to remember: throttling your car, your car can only go so fast.
Debouncing
enforces that a function not be called again until a certain amount of time has passed without it being called. As in “execute this function only if 100 milliseconds have passed without it being called.”
A easy way to remember: When a ball bounces, when it lands then you can do something else.
Related TILs
Tagged: javascript