```
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
console.log(computerChoice);
if (computerChoice < 0.34) {
return computerChoice = "rock";
}
if (0.34 > computerChoice < 0.66) {
return computerChoice = "paper";
}
else {
return computerChoice = "scissors";
}
```

# Why can't I use return before the computerChoices?

**nish1235**#1

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

Because as per these instructions, which need to be followed

```
function sum() {
var add = 1 + 1;
return add;
}
sum();
```

Take this example. Your function wants to display the sum of 1 + 1.

We'll calculate 1 + 1 and store it inside variable *add*.

Then we will ** return** variable add to

`function sum()`

In your exercise however, you need to store "rock", "paper", "scissors" in computerChoice.

**system**#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.