Rock, Paper, Scissors Lesson "Computer Choice: Part 1" Code Not Working


#1

So, I keep getting the an error after running the code. It appears after the prompt("Do you choose rock, paper, or scissors?"). It reads "Oops, try again. Did you set var computerChoice = Math.random() ? The capital 'M' in 'Math' is important!". What am I doing wrong? My code is below.

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

if (computerChoice < 0.33) {
    computerChoice = "rock";
} 
else if (computerChoice < 0.66) {
    computerChoice = "paper";
}
else if(computerChoice < 1){
    computerChoice = "scissors";
}
var compare = function (choice1, choice2) {
if (choice1 === choice2) {
    return "The result is a tie!"
}};

I can't find anything wrong with the code. I must be missing something.


#2

According to your title you might be ahead of the exercise. Part 1 expects computerChoice to be a number so if you already made it a string it might think that Math.random didn't work.