From b3cc2f32a29f408b342d35d5ab22f35bb7d58840 Mon Sep 17 00:00:00 2001 From: Hama Date: Wed, 26 Jun 2024 12:59:07 -0400 Subject: [PATCH] Fix and test rounds condition in playGame function --- script.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 7d2f88f..f945ecd 100644 --- a/script.js +++ b/script.js @@ -59,7 +59,7 @@ function playGame() { let computerScore = 0; let rounds = 5; - while (rounds > 0 && rounds <= 5){ + while (rounds >= 1 && rounds <= 5){ let humanSelection = getHumanChoice(); let computerSelection = getComputerChoice(); let winner = playRound(humanSelection, computerSelection); @@ -68,6 +68,7 @@ function playGame() { }else if (winner === 'computer'){ computerScore++; } + rounds--; } if (humanScore != computerScore) { (humanScore > computerScore) ? @@ -76,7 +77,7 @@ function playGame() { } } - +playGame();