From 97fb86c4b507558cfad5e42221fe7778636b587c Mon Sep 17 00:00:00 2001 From: lolabird Date: Sat, 30 Sep 2023 13:21:04 -0600 Subject: [PATCH] Change all console messages to return statements in game() --- script.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index a182996..73f0a5e 100644 --- a/script.js +++ b/script.js @@ -76,12 +76,14 @@ function game() { let winner = (p > c) ? true : false; if (winner) { - console.log("You won the game " + p + " to " + c + "! Great job!" ); + return "You won the game " + p + " to " + c + "! Great job!" ; } else { - console.log("You lost the game " + p + " to " + c + ". Better luck next time!"); + return "You lost the game " + p + " to " + c + ". Better luck next time!"; } + } else if (c === 0) { + return "Uh... I don't think you played the game right. Refresh the page and try that again." } else { - console.log("Whoa, you tied! Refresh for a rematch!"); + return "Whoa, you tied! Refresh for a rematch!"; } }