Junior — Senior
Creating a function with debounce effect
livecode
Task condition
Write a debounce function that limits the frequency of calling a given function, delaying its execution by a specified interval of time (in milliseconds). In the example below, the output console.log('API call') should occur no more than once every 300 ms after the last call.
const debouncedFn = debounce(() => console.log('API call'), 300);
debouncedFn();