Syntax error


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#
<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

SyntaxError: Illegal return statement

```

var userChoice = prompt(“Question?”);
var computerChoice = Math.random();
console.log(computerChoice);
if(computerChoice <= 0.33)
{
return computerChoice(rock);
}
else if(0.34< computerChoice < 0.67)
{
return computerChoice(paper);
}
else
{
return computerChoice(scissors);
}

<do not remove the three backticks above>

#2

return can only be used in function, you don’t have a function

You just need to update/re-assign the computerChoice variable.


#3

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