$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #130

What goes in the blank?

// returns a debounced function that delays calls by ms
function debounce(fn, ms) {
  let t;
  return (...args) => {
    ____(t);
    t = setTimeout(() => fn(...args), ms);
  };
}

Answer: clearTimeout (also accepted: clearTimeout, clearTimeout())

clearTimeout cancels the pending call before scheduling a new one.
Play Problem Solving ▸