"return" statement outside of function - help!


#1

Please could someone look at my code as I can't see what is wrong!

https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#

When I run the code, it gives a syntax error as detailed in the title of my post.

1 var userChoice = prompt("Do you choose rock, paper or scissors?");
2 var computerChoice = Math.random();
3 console.log(computerChoice);
4    if (computerChoice <= 0.33) {
5    return "rock";
6 } else if (computerChoice > 0.33 && <= 0.66) {
7   return "paper";
8 } else {
9    return "scissors";
10 }

Thank you!


#2

you need to update/re-assign computerChoice, who said anything about using return or &&?


#3

OK, thank you for the advice!


#4

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