This function prompts the user to pick either rock, paper, or scissors and changes the input to lowercase. If the user doesn't pick one of the above, the If statement is returned. But if the right choice is picked, the else statement is returned.
However, the else statement doesn't run if the user inputs an appropriate response.
function player() {
let pick = prompt("Rock, paper, or scissors?");
pick = pick.toLowerCase();
if ((pick !== 'rock') || (pick !== 'paper') || (pick !== 'scissors')) {
return `Please pick a valid choice ${pick}`;
} else {
return pick;
}
}
If I input something other than rock/paper/scissors, I expect the if statement to run. But if I input rock/paper/scissors, I expect the else statement to run.
However, the else statement never runs, no matter what.