<|im_start|>system
You are a helpful AI assistant.<|im_end|>
<|im_start|>user
Crear una función debounce en JavaScript<|im_end|>
<|im_start|>assistant
function debounce(fn, delay) {
  let timer;
  return function() {
    clearTimeout(timer);
    timer = setTimeout(() => fn.apply(this, arguments), delay);
  };
}<|im_end|>