else { alert(invalid choice!); }
how to make that happen and I don't really have the terminology down well enough to find anything useful on google or SO
}
, there probably is an extra }
:D
var userChoice = "null";
var choice = function(choice){
prompt("Do you choose rock, paper or scissors?");
if (choice === "rock") {
userChoice = "rock";
}
else if (choice === "paper") {
userChoice = "paper";
}
else if (choice === "scissors") {
userChoice = "scissors";
}
else {
alert("invalid choice!");
userChoice = "null";
}
}
choice (userChoice);
if (userChoice === "null") {
function choice()
}
else {
function compare()
}
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}
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"
}
}
else if (choice1 === "scissors") {
if (choice2 === "rock") {
return "rock wins";
}
else {
return "scissors wins";
}
}
}
alert (compare(userChoice, computerChoice));
@/all For those not on meetup’s MontCode email list, this message went out yesterday: Hello fellow MontCoders! 2016 has been an interesting year for the group! The group officially kicked off May 17th. Since then, we have has 31 weekly online chats, 13 meetups, and 2 lectures! We've posted nearly 14,000 messages in the chat room!
I am looking for ways to make 2017 even better than 2016. But, to do this I need to know what you want! I’ve created a survey to gather this information. If you could please just take a few minutes of your time it would be greatly appreciated. None of the fields are required and you can skip any fields you wish. However! If you complete every field (but the last one, you'll see it) your name will be entered into a hat. On the January 11th meetup, I will pull for a prize basket! I am still gathering more prizes but at this time we have stickers, an Arduino pro mini, and a gift card!