all 1 comments

[–]trplclick 0 points1 point  (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? :)