From bed1a2dfae32f042fcec90332cb4150214e3a3cd Mon Sep 17 00:00:00 2001 From: Thuan Bui <9248622+10h30@users.noreply.github.com> Date: Fri, 21 Feb 2025 20:04:51 +0900 Subject: [PATCH] Using loop --- script.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/script.js b/script.js index 50f7cd1..bb2a7ab 100644 --- a/script.js +++ b/script.js @@ -42,7 +42,7 @@ function playRound() { break; } break; - + case "PAPER" : switch (computerChoice.toUpperCase()) { case "ROCK" : @@ -82,11 +82,9 @@ function playRound() { function playGames() { //playRound(humanSelection, computerSelection); - playRound(); - playRound(); - playRound(); - playRound(); - playRound(); + for (let i = 0; i < 5; i++) { + playRound(); + } if (humanScore > computerScore) { console.log("You Win!"); }