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

167
Views
¿Cómo puede la función en mi eventlistener recibir un evento sin usar parámetros de función?

Estoy trabajando en un juego muy simple usando JavaScript estándar y el comportamiento que estoy viendo en este momento va en contra de todo lo que he aprendido acerca de las funciones. No entiendo por qué se puede llamar a getInput sin el paréntesis habitual que usaría al llamar a funciones. De hecho, cuando agrego paréntesis como este: document.addEventListener("keydown", getInput()); , no funciona en absoluto.

Entonces, ¿cómo puedo recibir e imprimir la clave del evento sin que se haya pasado como parámetro?

 document.addEventListener("keydown", getInput); function getInput() { console.log(event.key); }
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!