It sounds odd, but the theory is pretty simple.

Lets’s take a look at how debounce and throttle works first.
This a pretty simple realization of debounce and throttle. In the product environment, you should use Lodash or other similar strictly library.