Sobes.tech
Junior — Senior

Creating a debounce function with call delay

livecode

Task condition

It is necessary to write a debounce function that takes a handler function and a delay interval in milliseconds, and returns a new wrapper function. This wrapper should call the passed function only after the specified interval has passed since its last invocation.

const debounce = (fn, delay) => {
  // implementation
};

const handleInput = debounce(() => console.log('API call'), 6000);
handleInput();