Learnixo
Challenges

Implement Debounce

advanced 300 XP

Problem

Implement a `debounce` function. It returns a debounced version of a function that delays execution until after `delay` ms have elapsed since the last call.

Test Cases

Groups rapid calls
Input: Called 3x in 50ms with 200ms delay — fn called once after 200ms
Expected: fn called 1 time
Separate calls when gap exceeds delay
Input: Called twice, 300ms apart, with 200ms delay
Expected: fn called 2 times

Hints

AI Assistance