javascript intermediate Ends 2026-11-17

Debounce from scratch

Implement debounce(fn, wait) without any library. The returned function:

  • delays calling fn until wait ms have passed since the last call,
  • passes the latest arguments to fn,
  • has a .cancel() method that drops a pending call.

The tests use real timers; run the code and wait a moment for All tests passed.

Solved by 0 people so far.

javascript
EditorCtrl + Enter

            
        

When the tests print "All tests passed", the challenge is marked solved in this browser.

Submit your solution for review