Computer choice part 2


#1


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


This message appears every time: SyntaxError: 'return' statement outside of function


Replace this line with your code. 
var userChoice = prompt("Do you choose rock, paper, or scissors?")
var computerChoice = Math.random()
console.log(computerChoice)
if (computerChoice <= .33) {
    return computerChoice = "rock";
} else if (computerChoice >= .34 && computerChoice <= .66) {
    return computerChoice = "paper";
} else {
    return computerChoice = "scissors";
}


#2

move this print statement over to the line after the bracket it should be the last line of that excercise


#3

I'm still getting the same error


#4

And also, remove all the return's that come before your value assignments.

That should fix the error. :slight_smile:


#5

That worked. Thanks!


#6

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