Change all console messages to return statements in game()
This commit is contained in:
parent
565ab3c772
commit
97fb86c4b5
1 changed files with 5 additions and 3 deletions
|
|
@ -76,12 +76,14 @@ function game() {
|
||||||
let winner = (p > c) ? true : false;
|
let winner = (p > c) ? true : false;
|
||||||
|
|
||||||
if (winner) {
|
if (winner) {
|
||||||
console.log("You won the game " + p + " to " + c + "! Great job!" );
|
return "You won the game " + p + " to " + c + "! Great job!" ;
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
console.log("Whoa, you tied! Refresh for a rematch!");
|
return "Whoa, you tied! Refresh for a rematch!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue