Garmaine Staff asked 2 years ago

I tried to add the numbers one after the other.

For example, if the number was 10 and then 4 the output would be 14.

let getPlayer2Value = document.querySelector(".getValueP2")
getPlayer2Value.addEventListener("click", init);

function init() {    
  window.roundScore = 0;
  window.diceValue =  Math.floor(Math.random() * 6) + 1;
  window.player2Score = document.querySelector(".totalScoreP2");

  getPlayer2Value.addEventListener("click", () =>
  {
    roundScore += dice;
    player2Score.innerHTML = roundScore;
  });
}