Skip to content

Instantly share code, notes, and snippets.

@munro
Created December 13, 2012 07:29
Show Gist options
  • Save munro/4274777 to your computer and use it in GitHub Desktop.
Save munro/4274777 to your computer and use it in GitHub Desktop.
rock papa sizzas
var choice1 = prompt("Do you choose rock, paper or scissors?");
var choice2 = Math.random();
if (choice2 <0.34){
choice2 = "rock";
}else if(choice2 <=0.67){
choice2 = "paper";
}else{
choice2 = "scissors";
}
var compare = function (choice1,choice2)
if (choice1 = choice2){
console.log("The result is a tie!");
};
if (choice1 = rock) {
if (choice2 === "paper") {
returns("paper wins");
} else{
returns("scissors win");
};
}
if (choice1 = paper) {
if (choice2 = "rock"){
returns("paper wins");
}else{
returns("scissors win");
}
}
if (choice1 = scissors) {
if (choice2 = "paper"){
returns("paper wins");
}else{
returns("Sissors win");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment