(im a beginner and sorr for my bad english) im just messing around with else, if statement and i am working on a rock paper scissors game. then i do not know whats wrong with my code. when i run it sometimes it dont print out the console log like i wanted. for example, P1 (player 1) picks paper and P2 picks rock, then it will say that its a tie. please help me
code:
var player1 = prompt("(P1) rock, paper, or scisors? : ");
var player2 = prompt("(P2) rock, paper, or scisors? : ");
if (player1 === "rock", player2 === "paper"){
console.log("P2 WINS!")
} else if (player1 === "rock", player2 === "scissors"){
console.log("P1 WINS!")
} else if (player1 === "rock", player2 === "rock"){
console.log("TIE!")
} else if (player1 === "paper", player2 === "rock"){
console.log("P1 WINS!")
} else if (player1 === "paper", player2 === "scissors"){
console.log("P2 WINS!")
} else if (player1 === "paper", player2 === "paper"){
console.log("TIE!")
} else if (player1 === "scissors", player2 === "rock"){
console.log("P2 WINS!")
} else if (player1 === "scissors", player2 === "paper"){
console.log("P1 WINS!")
} else {
console.log("TIE!")
};