Javascript Functons: Rock, Paper or Scissors


#1

I’m on step 5 of this lesson. I keep getting a return that randomNumber is not defined and I can’t figure out why. My answer looks identical to the hint to me. I’ve been looking at it for way too long, any help would be appreciated.

const getComputerChoice = () => {
Math.floor(Math.random() * 3);
switch (randomNumber) {
case 0:
return ‘rock’;
case 1:
return ‘paper’;
case 2:
return ‘scissors’;
}
}
console.log(getComputerChoice())


#2

You have a switch based on a variable called randomNumber
You never defined randomNumber
I think you wanted Math.floor(Math.random()*3) to be your randomNumber Variable
So let it