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

162
Views
¿Por qué console.log("Llamado"); se llama solo una vez dentro de la función de rebote?

En el siguiente código, por qué console.log ("Llamado"); solo viene una vez, aunque la función de rebote se llama una y otra vez en cada evento de activación

 const txt = document.getElementById("text"); let label = document.getElementById("label"); function debounce(fun,delay) { let time; console.log("Called"); return function(args) { if(time) { clearTimeout(time); } time = setTimeout(() => { fun(args); },delay); } } function callback(e) { label.innerHTML = e.target.value; } txt.addEventListener("keyup", debounce(callback,700)); </script>
 <html> <body> <input type="text" id="text" placeholder="Enter something..."><br /> <label id="label"></label> </body> </html>

?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Se llama mientras se configura el detector de eventos. Incluso antes de cualquier evento keyup. Si desea iniciar sesión cuando se llama a la función. Regístrelo dentro de la función que se devuelve desde el rebote.

about 4 years ago · Juan Pablo Isaza Report
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!