if (computerChoice < 0.25) {
computerChoice = "rock";
}
else if (computerChoice <= 0.50) {
computerChoice = "paper";
}
else if (computerChoice <= 0.75) {
computerChoice = "llama";
}
else {
computerChoice = "scissors";
}
You're getting the random number and if it's below 0.25 or 0.50 assigning the choice to be "rock" or "paper" but then you're checking if it's below 0.75 and assigning the choice as "llama" (which will override the previous choices), otherwise it's choosing scissors.Last reply 1 month ago
Free website hosting providers with no strings attached?Posted 3 months ago
iDEA silver citizen badge three. Milkshake shack coding problem.Last reply 4 months ago
How do you practice programming java for beginners?Last reply 8 months ago
hows the employment market for tech work in the UK?Last reply 1 month ago
Free website hosting providers with no strings attached?Posted 3 months ago
iDEA silver citizen badge three. Milkshake shack coding problem.Last reply 4 months ago
How do you practice programming java for beginners?Last reply 8 months ago
hows the employment market for tech work in the UK?