Why not working

const getuserChoice = userchoice => {
userInput = userInput.toLowerCase();
if(userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’) {
return userInput
} else {
return ‘Error, please type: 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’

const determineWinner = (userChoice, computerChoice) => {
if (userChoice === computerChoice)
return ‘this game is a tie’

if (userChoice === ‘rock’) {
if (computerChoice === ‘paper’)
return ‘sorry computer won’;
} else {
return ‘congratulation you won’;

if (computerChoice === ‘scissors’) {
if (computerChoice === ‘rock’)
return ‘sorry computer won’;
} else {
return ‘congratulations you won’;



Heya {@core3869883512}

First of all, I would recommend that you read up on How to Format code in posts. It will make everything easier for everyone in the future :+1:

I am pretty new to this myself, but I really want to help. I’ll try to explain this as best as I can, but you have to figure it out. It is the best way to learn :slightly_smiling_face:

This has nothing to do with the Error, but on some of your return statements you have a semicolon, and on some you don’t. You should really practice using the semicolon, because it is the stuff like this that probably made you make a mistake on this step. Keep your code tidy!

Your problem is at step 8. And I would recommend that you read it thoroughly and think about it for a minute. Like really, try to wrap your head around the instructions.

Inside the if statement’s block, write another if / else statement.

Do you remember at the start of the course, how it said that the computer will execute anything we tell it to, it just has to be every step explained. Like if we want to walk, first we lift our foot up, we move it ahead, step down. I am sorry if this makes no sense :sob: Just wanted to give an example of how we have to explain everything thoroughly to our computer in order for it to work the way we need it to.

And right after you started your function determineWinner you made a mistake. It’s like you just slid the foot forwards, and didn’t lift it up as we were instructed to. Your mistake happens throughout the if statements.

I will help you more and send you towards where to look, answer might be easy and curly :thinking: . Remember that sometimes our code will end up broken & give us an error if we miss a semicolon.

If Statement

Thank for reaching out for help! Hope that I helped you in some kind of way at least. Remember to Learn about our community forums. It will help you to navigate the Forum easier :smiley:



This might help rock-paper-scissors
And as mentioned by @ktoni73 How to format code in posts is very important and you can also add a link to the lesson on which you’re having some issues, it helps the community to understand the context to better help you.


Thanks for taking time to reply.
I will do better next time :blush:


Worked for me as well :grinning:

1 Like