Fix syntax issues
This commit is contained in:
parent
1f986c09e7
commit
c267800ab9
1 changed files with 15 additions and 24 deletions
39
script.js
39
script.js
|
|
@ -14,42 +14,33 @@ function playRound(playerSelection, computerSelection){
|
||||||
p = playerSelection.toLowerCase();
|
p = playerSelection.toLowerCase();
|
||||||
c = computerSelection.toLowerCase();
|
c = computerSelection.toLowerCase();
|
||||||
|
|
||||||
if (p === c) {
|
if (p === c) {
|
||||||
return "tie";
|
return "tie";
|
||||||
} else if (p === "rock") {
|
} else if (p === "rock") {
|
||||||
if (c === "paper") {
|
if (c === "paper") {
|
||||||
return "player loses";
|
return "player loses";
|
||||||
} else { //scissors
|
} else { //scissors
|
||||||
return "player wins"
|
return "player wins";
|
||||||
}
|
}
|
||||||
} else if (p === "paper") {
|
} else if (p === "paper") {
|
||||||
if (c === "scissors") {
|
if (c === "scissors") {
|
||||||
return "player loses";
|
return "player loses";
|
||||||
} else { //rock
|
} else { //rock
|
||||||
return "player wins"
|
return "player wins";
|
||||||
}
|
}
|
||||||
} else if (p === "scissors") {
|
} else if (p === "scissors") {
|
||||||
if (c === "paper") {
|
if (c === "paper") {
|
||||||
return "player loses";
|
return "player loses";
|
||||||
} else { //scissors
|
} else { //scissors
|
||||||
return "player wins"
|
return "player wins";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return "not a valid entry"
|
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function game(playerSelection, computerSelection) {
|
function game(playerSelection, computerSelection) {
|
||||||
// for (var i = 0; i < 5; i++)
|
for (var i = 0; i < 5; i++) {}
|
||||||
//playRound(playerSelection, computerSelection)
|
//playRound(playerSelection, computerSelection)
|
||||||
|
|
||||||
//count how many times p and c have won
|
//count how many times p and c have won
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue