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
clearTimeout cancels the pending call before scheduling a new one.
Play Problem Solving ▸