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

159
Vistas
Pause menu in JavaScript?

I'm trying to make a pause menu for a game me and my friends are making, I was wondering if js has a simple way to make a keypress function that pauses the game? are they any? thank you!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try adding an event listener with the key you want to have the game pause:

// adds an event listener to the document that listens for key presses
document.addEventListener("keydown", function(e) {
// if desired key pressed, pause 
// Replace Escape with the key you want to execute the pause function
  if (e.key === "Escape") {
    pause();
// else do nothing
   } else {}
});

To find the key code for the key you want to execute the function, I recommend using keycode.info.

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