Add getPlayerChoice function

This commit is contained in:
lolabird 2023-11-07 14:52:42 -07:00
commit 4301364cbb

View file

@ -1,3 +1,9 @@
function getPlayerChoice(){
let ps = prompt("Rock, Paper, or Scissors?")
return ps;
}
function getComputerChoice(){
let compAnswer = Math.floor(Math.random() * 3) + 1;
@ -45,7 +51,7 @@ function game() {
let c = 0;
while (p < 5 && c < 5) {
const ps = prompt("Rock, Paper, or Scissors?");
const ps = getPlayerChoice();
const cs = getComputerChoice();
play = playRound(ps, cs);