Coffescript Callbacks & Functions
问题 I have this function and I am trying to use two large functions made up of smaller ones and one while loops. One for when it's the players turn, one when it's the opponent's turn, and a while loop when the player has won. When I run it in the browser, the buttons do not do anything. What is wrong? $attackButtonClick = (opponent) -> if playersTurn and not player.Win player.attack(opponent) if opponent.currentHealth <= 0 player.Win = true; allOff() postBattle(opponent) else playersTurn = false;