SyntaxError on step 4


SyntaxError: missing before statement trigger when i run the below code:

if (computerChoice <== 0.33){
    computerChoice = "rock";}
    else if (computerChoice >== 0.67){
        computerChoice = "scissors";}
        else {
            computerChoice = "paper";}


javascript doesn't have a <== and >==, it should be: <= and >=. You do realize that between .33 and .67 now is paper, and .67 and higher is scissors?


this is in JavaScript, not Python?

and the instructions state equal to or less than 0.33 is rock, greater than and equal to 0.67 is scissor, and 0.34-0.66 is paper.


silly me, i was planning on saying javascript. point still stands, <== doesn't exist in javascript

then it is fine, but different. Most people do computerChoice <= .67 and then set computerChoice to paper, but methods works.


not a problem at all, just like to make sure is all :slight_smile:

unfortunately making that change is still triggering the same error message when I run it... is it possible that this may be a browser or webpage issue (using Firefox)? or could there be something else hiding in the syntax do you think?


Can i see an updated version of your full code?


here's the code:

var userChoice === prompt("Do you choose rock, paper or scissors?");
var computerChoice === Math.random();

if (computerChoice <= 0.33){
    computerChoice = "rock";}
    else if (computerChoice >= 0.67){
        computerChoice = "scissors";}
        else {
            computerChoice = "paper";}

Error message reads "SyntaxError: missing before statement" still.

edit: everything above the If/if else/else statement was populated from the prior steps of the exercise.


in line 1 and 2 of your code, you want to create userChoice and computerChoice variable. To assign a value to a variable, you need to use a single equal sign:

var example = "this is just an example"

3 equal signs are for comparing, not for assigning.


awesome that was it! thanks so much for the help!