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" 时,此挑战会在本浏览器中标记为已解决。

提交您的解决方案进行审核