Simplest debounce function!

Frontend developer at Reliance JIO
Below is the simplest debounce method implementation. Forget using args and apply methods. This is just very basic and suffices the requirement
const debounce = (fn, delay) => {
let res;
clearTimeout(res);
res = setTimeout(() => {
fn();
}, delay);
};
How to use:
debounce(someFunction(), 1000)
Hope it helps!


