Here is the link of my Code… please reply what’s the mistake I have been making.
Thanks for your feedback.
Hi! Thanks for sharing your code and welcome to the forums
What is the error the console is giving you?
2 Likes
Welcome to the forums!
Can you tell us what the “unexpected error” you’re seeing is?
Edit: Darn it @toastedpitabread, you and your speedy typing!
2 Likes
I’m just quick to not understand
That error is a syntax error message, meaning that you’re probably missing a curly brace. (I have issues with the fact it doesn’t give you the proper line but that’s another story).
For me personally: having a good practice of indentation can help weed these errors out before they start appearing everywhere. I’ve re-indented some of your code where I think the error was, see if you can spot it.
const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') {
return userInput;
} else if (userInput==='bomb') {
console.log('Great choice! You can destroy everything. You have won the game.');
} else {
console.log(`Your choice as ${userInput} is invalid`);
}
//const getComputerChoice etc
1 Like
Thanks for the help. I acknowledge your valuable advice.
1 Like