Untitled

 avatar
unknown
plain_text
10 months ago
522 B
5
Indexable
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");
}
Editor is loading...
Leave a Comment