combining multiple || in do while

Posted: asked May 19 at 11:31 - Source : stackoverflow

I'm making a simple rock papper scissors game in JS;

I did it according to my task, but I wanted to improove it. I want to forbid user from putting anything but "rock" "papper" or "scissors" into the prompt window. Without minding weather it's upper case or lower case.

Everything works properly except for filtering out all the unwanted words.

I'm quite sure that the problem lays within the while line. If I delete everything and leave just, say, papper, it works a.k.a. it doesn't accept anything until I write papper, but if I want to do this with all of these, it doesn't allow me to enter anything. It keeps on refreshing.

Any Ideas? :)

alert("Lets play rock, papper scissors!");
//******COMPUTER'S PICK
var cPick = Math.floor(Math.random() * 3) + 1;
switch(cPick){
	case 1:
	cPick = "rock";
	break;
	case 2:
	cPick = "papper";
	break;
	case 3:
	cPick = "scissors";
	break;
}
console.log(cPick);
//******YOUR PICK
var isValid = false;
//*********
var yourPick;	
do{ 
	yourPick = prompt("Your pick! Choose Rock, Papper of Scissors");
	yourPick = yourPick.toLowerCase();
	console.log(yourPick);
} while ((yourPick !=="papper") || (yourPick!=="rock") || (yourPick!=="scissors"));
 if (yourPick == cPick){
 	document.getElementById("demo").innerHTML = ("You both chose " + yourPick + "! It's a tie.");
	 } else if (yourPick == "rock" && cPick == "scissors"){
	 	 document.getElementById("demo").innerHTML = ("You've picked " + yourPick + ". Computer choose " + cPick + "! You win!");
	 } else if (yourPick == "scissors" && cPick == "papper"){
	 	 document.getElementById("demo").innerHTML = ("You've picked " + yourPick + ". Computer choose " + cPick + "! You win!");
	 } else if (yourPick == "papper" && cPick == "rock"){
	 	 document.getElementById("demo").innerHTML = ("You've picked " + yourPick + ". Computer choose " + cPick + "! You win!");
	 } else if (yourPick == "rock" && cPick == "papper"){
	 	 document.getElementById("demo").innerHTML = ("You've picked " + yourPick + ". Computer choose " + cPick + "! You loose!");
	 } else if (yourPick == "scissors" && cPick == "rock"){
	 	 document.getElementById("demo").innerHTML = ("You've picked " + yourPick + ". Computer choose " + cPick + "! You loose!");
	 } else if (yourPick == "papper" && cPick == "scissors"){
	 	 document.getElementById("demo").innerHTML = ("You've picked " + yourPick + ". Computer choose " + cPick + "! You loose!");
	 }
.container{
	width: 80%;
	background-color: cyan;
	border: 4px solid blue;
	color: black;
	margin: 20rem auto;
	text-align: center;
}
#demo{
	font-size: 2rem;
	font-weight: 600;
}
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
	<div class="container">
		<p id="demo"></p>
	</div>

	<script src="script.js" type="text/javascript"></script>
</body>
</html>