This did not return anything to the console and Im just wondering why after checking it multiple times. I know there are other ways to do it but this was the first way that came to my mind;
const getUserChoice = (userInput) => {
userInput = userInput.toLowerCase();
if (
userInput === “rock” ||
userInput === “paper” ||
userInput === “scissors”
) {
return userInput;
} else {
return “Invalid Input”;
}
};
const getComputerChoice = () => {
let numValue = Math.floor(Math.random() * 3);
switch (numValue) {
case 0:
return “rock”;
break;
case 1:
return “paper”;
break;
case 2:
return “scissors”;
break;
default:
return null;
}
console.log(getComputerChoice());
console.log(getComputerChoice());
console.log(getComputerChoice());
};