Fix syntax issues

This commit is contained in:
lolabird 2023-09-30 10:52:40 -06:00
commit c267800ab9

View file

@ -14,42 +14,33 @@ function playRound(playerSelection, computerSelection){
p = playerSelection.toLowerCase();
c = computerSelection.toLowerCase();
if (p === c) {
if (p === c) {
return "tie";
} else if (p === "rock") {
} else if (p === "rock") {
if (c === "paper") {
return "player loses";
} else { //scissors
return "player wins"
return "player wins";
}
} else if (p === "paper") {
} else if (p === "paper") {
if (c === "scissors") {
return "player loses";
} else { //rock
return "player wins"
return "player wins";
}
} else if (p === "scissors") {
if (c === "paper") {
return "player loses";
} else { //scissors
return "player wins"
}
} else {
return "not a valid entry"
}
//else if p === "paper"
//if c === "scissors" player loses
//if c === "rock" player wins
//else if p === scissors
//if c === "rock" player loses
//if c === "paper" player wins
// else
//Not a valid entry
} else if (p === "scissors") {
if (c === "paper") {
return "player loses";
} else { //scissors
return "player wins";
}
} else {
return "not a valid entry";
}
}
function game(playerSelection, computerSelection) {
// for (var i = 0; i < 5; i++)
for (var i = 0; i < 5; i++) {}
//playRound(playerSelection, computerSelection)
//count how many times p and c have won