Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!