No error message,but still not working my code

Rock, Paper, or Scissors
Hi everyone!
I am working on Rock, Paper, or Scissors project. The task 6. I should console.log(getComputerChoice),but I do not get anything on the console.

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

I don’t get error message, so what should I do?
Nóra

Hi Nab-sa!
Thanks for your help. Unfortunately didn’t work your suggestion.
What I actually missed to define a randomNumber and that use in the switch. But I need the return,because otherwise it will return,the numbers not the rock,paper or scissors.

const getComputerChoice = () =>{
const randomNumber =Math.floor(Math.random()*3);
switch (randomNumber) {
  case 0: 
  return 'rock';
  case 1: 
  return 'paper';
  case 2:
  return 'scissors';
};
}
console.log(getComputerChoice());
console.log(getComputerChoice());
console.log(getComputerChoice());
console.log(getComputerChoice());
// paper,paper,rock,paper
 
Thanks again :)
1 Like