I'm stuck! on 4.build "Rock, Paper, Scissors"


#1

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
console.log(computerChoice);
if (computerChoice <= .33) {
computerChoice="Rock";
} else if (computerChoice < .66) {
computerChoice="Scissors";
} else
{ computerChoice="Paper";
}

This is my code and error say:

Oops, try again. Did you set var computerChoice = Math.random() ? The capital 'M' in 'Math' is important!

What do i do?


#3

This seems to be fine to me. Maybe it's about starting your strings with upper case letters.

Merry Christmas :christmas_tree:


#4

Hey, remove the ; after Math.random();
Usually, the colon doesnt create a problem, if you were using another console. But the Codecademy console somehow does not like a colon after Math.random, I guess. I had the same problem when I was working on that. But then I figured it out. just try doing that.
Hope it works!!!
Have fun coding!!


#5

No the semicolon after Math.random() is totally fine that error occurs mostly when computerChoice is not a number in exercise 3 but has the OP is stating that this is for exercise 4 I'm a bit confused as what is written is ok only the upper case letters on the strings are not as mentioned in the instructions.