RockPaperScissors project: Help with comparing numbers in if/else

This is step 5 on the Rock Paper Scissors project. The step asks to create a function for the computer choice. This is what I have, but when I check on the console, the numbers are not appearing right. They are random each time instead of zero being strictly rock and so on. I believe it is because the number variable is not properly being compared to the actual number. I also understand that I can just write it using switch but was wondering how to do it specifically using if/else. Can anyone help guide me in this?

const getComputerChoice = () => {
let randomNumber = Math.floor(Math.random() * 3);
if (randomNumber === 0){
return ‘rock’;
else if (randomNumber === 1){
return ‘paper’;
else {
return ‘scissors’;



Your function does not take any arguments as it generates its own number for the if statement.