4. Still needing help


#1



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


var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice <= 0.33)
    computerChoice = "rock"
else if (computerChoice => 0.33 and <= 0.66)
    computerChoice = "paper"
else 
    computerChoice = "scissors"

What is wrong with this? I have been racking my brain for hours.

Error message near the "save & submit code" button:'Oops, try again. There was a problem with your syntax.'

On the console log: 'SyntaxError: Unexpected identifier'

Please help me!


#2

Syntax for if / else if / else should be like this:

if (condition1) {
    //something
} else if (condition2) {
    //something
} else {
    //something
}

JS glossary - CodeCademy


#3

OH haha I forgot those


#4

but

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

still ha s syntax


#5

your missing semi colons (others as well)

Look at this properly ..
and is not valid in JS, You need to use &&