Debouncing & Throttling are the techniques to optimise the system. Basically these are used to prevent the too much function calls. let discuss one by one.
Debouncing: