javascript intermediate Se termine le 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.

Résolu par 0 personnes pour l’instant.

javascript
ÉditeurCtrl + Enter

            
        

Quand les tests affichent "All tests passed", le défi est marqué comme résolu dans ce navigateur.

Envoyer votre solution pour relecture