Help with rock paper scissors


#1

I need help with making the game state a phrase when the user picks a choice that is not rock, paper or scissors. I tried at the bottom but it has no effect on the game.
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer chooses " + computerChoice);
console.log( "You chose " + userChoice);
var compare = function(choice1 , choice2){
if(choice1 === choice2) {
return "The result is a tie!";
}
else if(choice1 ==="rock") {
if(choice2 === "scissors"){
return "rock wins";
}
else {
return "paper wins";}
}
else if (choice1 === "paper") {
if(choice2 === "rock") {
return "paper wins";
}
else{
return "scissors wins";
}
if (userChoice != "rock" || "paper" || "scissors"){
return " try again ya dingus" }
}
}
compare(userChoice, computerChoice);


#2

personally, if i have to validate user input it is the first thing i will do:

var compare = function(choice1 , choice2){
if (userChoice != "rock" || "paper" || "scissors"){
        return " try again ya dingus" }
/* rest of the code */

then another problem, you can't do what you do, you have to specify userChoice each time:

if (userChoice != "rock" ||  userChoice != "paper" || userChoice != "scissors")

and you want to check that the choice is not rock and not paper and not scissors, so i would use the and operator (&&) rather then the or operator (||)