Ajax-loader-large-white
Build "Rock, Paper, Scissors"
Computer Choice: Part 2

We have computerChoice but it now equals a random number between 0 and 1. We need to somehow translate this random number into a random choice of rock, paper, or scissors. How do we do this?!

  1. If computerChoice is between 0 and 0.33, make computerChoice equal to "rock".
  2. If computerChoice is between 0.34 and 0.66, make computerChoice equal to "paper".
  3. If computerChoice is between 0.67 and 1, make computerChoice equal to "scissors".

But there are three outcomes! Using if / else only lets us have two outcomes. What now?! We need to use if / else if / else. See the hint for the full syntax. You will laugh at how easy it is.

Instructions
  1. Under your existing code, write out the if / else if / else statement.
  2. In the respective code blocks, change the value of computerChoice based on the rules stated above. Remember, you do NOT have to use var when changing the value of a variable that already exists.
?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Syntax for if / else if / else should be spaced like:

if (condition1) {
    code code code;
} else if (condition2) {
    code code code;
} else {
    code code code;
}
script.js