Hard
How to Implement Immediate Execution in JavaScript Debounce Function
How can you modify the function debounce to ensure it runs the provided function immediately on the first call, and then debounces subsequent calls?
1const debounce = (func, delay) => {2 // Your implementation here3};45const logMessage = debounce((msg) => console.log(msg), 300);6logMessage("First call");7setTimeout(() => logMessage("Second call"), 100);8setTimeout(() => logMessage("Third call"), 400);