Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
How does a pointer event passed as an argument in debounce?

I am confused about how the pointer event is passed to the debounce() in addEventListener(). For the constant variable multiply it takes the two arguments which are passed as args in debounce(). However, when it is used in .addEventListener() I only see the syntax that defines the function. So how does the pointer event is passed as an argument like the first example?

function debounce(func, timeout = 1000) {
  let timer;
  return (...args) => {
    if (timer) clearTimeout(timer);
    timer = setTimeout(() => {
      func(...args);
    }, timeout);
  };
}

const multiply = debounce((x, y) => console.log(x * y));
multiply(10, 10); //I see that this takes the arguments that assign to x and y 
 
button.addEventListener(
  "click",
  debounce((e) => console.log("clicked")));
//but here I am confused how the pointer event is being passed as an argument
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda