Hi
I am stuck, I am new into programming and have issues with this excercise, it doesnot show display anything, no errors, no game.
const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
if (userInput === ‘rock’ || userInput===‘paper’ || userInput===‘scissors’){
return userInput;
} else {
console.log(‘There is an error.’);
}
};
const computerChoice = Math.random();
if (computerChoice <= 0.33){
return ‘paper’;
}
else if (computerChoice >= 0.34 && computerChoice <= 0.66){
return ‘rock’;}
else {
return ‘scissors’;
}
const compare = (choice1 , choice2) =>{
if (choice1 === choice2){
return ‘Tie’;
}
else if (choice1 === ‘paper’){
if (choice2 === ‘rock’){
return ‘paper wins’;
}
else {
return ‘scissors wins’
}
}
else if (choice1 === ‘scissors’){
if (choice2 === ‘paper’){
return ‘scissors wins’;
}
else{
return ‘rock wins’;
}
}
else if (choice1 === ‘rock’){
if (choice2 === ‘scissors’){
return ‘rock wins’;
}
else {
return ‘paper wins’;
}
}
}
const playGame =()=>{
userInput(‘scissors’);
computerChoice(‘rock’);
console.log(compare(userInput, computerChoice));
}
playGame();
That’s my code.