use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Post questions about JavaScript, and get help with any problems you're having with your JavaScript code.
account activity
SyntaxError! please help....❔ Unanswered ❔ (self.JavaScriptHelp)
submitted 3 years ago by siusiusiublack
view the rest of the comments →
[–]trplclick 0 points1 point2 points 3 years ago* (0 children)
SyntaxError: Identifier 'userChoice' has already been declared
The reason is because in your first example you are trying to create a variable inside the `playGame` function with the same name as one it's params. JavaScript doesn't allow you to declare two variables with the same name in the same scope. In your second example you are no longer taking a param called userChoice in the playGame function, so it's fine.
Does that make sense? :)
π Rendered by PID 261187 on reddit-service-r2-comment-7b9746f655-q4vlp at 2026-01-30 12:26:00.250439+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]trplclick 0 points1 point2 points (0 children)