I want the user to be able to choose whether they want the received ace card to be worth 1 or 11. I therefore prompt them with two buttons (#aceOne and #aceEleven) but I want to wait until they set the value themselves by pressing one before continuing the game.
The pressed buttons invoke the function aceWorth(ace)(This function also does other things) - passing the parameter 1 or 11 depending on button press, the function sets its value.
So - how do I force halt the code until the user presses one of the buttons - and then run the function (aceworth) to set the value of the card?
document.getElementById("aceOne").addEventListener("click", aceWorth(1))
document.getElementById("aceEleven").addEventListener("click", aceWorth(11))
function aceWorth(ace){
window.cardValue = ace}