Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
522 B
2
Indexable
Never
const updateScore = () => {
  const score = parseInt(document.getElementById("score").innerText);
  const updatedScore = score + 1;
  document.getElementById("score").innerText = updatedScore;

  return updatedScore; // Return the updated score directly
};

function gameOver() {
  const finalScore = updateScore(); // Call updateScore and get the updated score
  document.getElementById("score-count").innerText = finalScore; // Use the updated score directly
  switchScreen("play-ground", "score-board");
}
Leave a Comment