SDE2 Polyfill

Implement Debounce Function

Implementation & Test Harness

Editable Monaco Runner
JavaScript Lab Sandbox
function debounce(fn, args) {
  let inDebounce;
  return function () {
    clearTimeout(inDebounce);
    inDebounce = setTimeout(() => {
      fn.apply(this, args);
    });
  };
};
Console Output
Click "Run Code" above to execute and view output...