Javascript

Can someone one help me figure out what’s wrong with the code below?

const getUserChoice=(userInput)=>{
userInput = userInput.toLowerCase();
}
if (userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’)
{return userInput;} else { console.log(‘Error!’);
}

Missing a closing brace on the function body.

1 Like

Your function ends before the if statement, which means you can’t return any values. You need to move that closing curly brace to the bottom.

(Also, please format your code next time. You can do this by wrapping it in triple backticks or by clicking on the </> symbol and pasting your code in there.)

1 Like