HELP, I'm trying to create a rockpaper scissors game out of only if-else statements
It only displays "you lose" no matter what. How can i fix that? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <script> var rock; var paper; var scissors; var compVal; var choose = prompt("Enter 'r', 'p' or 's' to choose rock, paper or scissors respectively."); if (choose == "r" || choose == "p" || choose == "s") { compVal =(Math.random()*3 + 1); if (choose == "p" && compVal == 1) { alert("You win"); } else if (choose == "s" && compVal == 2) { alert("You win"); } else if (choose == "r" && compVal == 3) { alert("You win"); } else if (choose == "r" && compVal == 1) { alert("You tie"); } else if (choose == "p" && compVal == 2) { alert("You tie"); } else if (choose == "s" && compVal == 3) { alert("You tie"); } else { alert("You lose"); } } </script> </body> </html>