168 views
Creating a debounce function with correct delayed invocation
Task condition
It is necessary to implement a debounce function that, when called multiple times, delays the execution of the passed function until the specified interval has elapsed, ensuring that the callback is executed only once after the timeout.
const debounce = (fn, delay) => setTimeout(() => {
fn();
}, delay);