javascript intermediate מסתיים ב-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.

נפתר עד כה על ידי 0 אנשים.

javascript
עורךCtrl + Enter

            
        

כשהבדיקות מדפיסות "All tests passed", האתגר מסומן כפתור בדפדפן הזה.

שליחת הפתרון לבדיקה