Hello, Can someone please assist me? I am trying to run my code, but there is nothing in my console running and doesn’t show anything, I have completed from step 1 to step 3.
Please assist. thank you
Hello, Can someone please assist me? I am trying to run my code, but there is nothing in my console running and doesn’t show anything, I have completed from step 1 to step 3.
Please assist. thank you
Clicking on that link won’t show us your code. Please copy+paste the code here and use the </> button in the post editing bar to format it.
Thank you for letting me know, here is he code
const getUserChoice = (userInput) => {
userInput = userInput.toLowerCase();
if (((userInput = “rock”), “paper”, “scissors”)) {
return userInput;
} else {
console.log(“Error!!!”);
}
console.log(getUserChoice(“Paper”));
};
Quick note: I don’t seem to have the </> button in my editor. But you can also format code blocks by wrapping it in chunks of three back-ticks. That will make it easier for other people to read and help you (I think it was actually @javaace96747 who taught me that in another comment too, lol).
You have a couple problems in your “if” conditional. “=” (a single equals sign) is the assignment operator, you need to use one of the equality operators for making comparisons (“==” or “===”). The syntax is also wrong. If you need to make several comparisons separated by “or” it needs to follow the form
`if (x === 'a' || x === 'b' || x === 'c')
where “||” is the logical “or” operator.
Also, it looks like your console.log statement that calls the function is inside of your function expression, so when you run the program, nothing is actually calling it .
I think it should work after you address those.
Thank you so much
It really helped a lot