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
})