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

153
Vistas
Return a variable after a button click in javascript/jquery

I'm attempting to keep information about a card game (blackjack) held in a global variable to be passed through the different button click functions. Is there anyway to assign a variable on a button click? Here's an example of the code I am trying. It doesn't seem to save the dictionary to the global gameInfo variable. How can I do this? Thanks!

gameInfo = $dealButton.on('click', function(event) {
  
        var gameInfo = {
            "deckOfCards": [1, 2, 3, 4],
            "playerCards" : ["Ace", "King"],
            "dealerCards" : ["5", "6"],
        }

 
        return gameInfo
})
about 4 years ago · Santiago Gelvez
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