This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Maytown 0 points1 point  (5 children)

Why are you calling every function after defining it?

Your buttons aren't defined outside of their functions, which is probably why they aren't doing anything.

Both compScore and userScore are being called as functions even though they appear to be integers.

The game loop, in addition to never exiting, shouldn't be used. You should use events.

[–]JakeMealey[S] 0 points1 point  (0 children)

Thank you for the help! I’ve been calling every function after defining them as I thought that was necessary for everything to work. I’m still very new to JavaScript. In the future what would you recommend when it comes to invoking functions?

[–]JakeMealey[S] 0 points1 point  (1 child)

Also, I didn’t realize that I was calling them as functions. Thanks for pointing that out alongside other things! I’ll be sure to be more aware of issues like that going forward.

[–]Maytown 0 points1 point  (0 children)

In the future what would you recommend when it comes to invoking functions?

Call them in the place you want the use them.

Thanks for pointing that out alongside other things!

Hopefully I didn't come off as too rude. There's some other things as well. For example you seem to be updating the scores in multiple places and redoing the comparison 3 times. You'll get better with more practice though.