There are a few questions in your post - I’ll try to answer as much as I can and perhaps others can fill in the gaps. If you can share your entire code base via github or paste it here it will make things easier for myself and others to understand.
An important thing to note is
X=X++ is NOT a valid expression. You can try it out on its own (using console logs) it doesn’t behave as you might expect. The appropriate way to use this shorthand syntax is to just use the experssion
X++ which says take X and add 1 to it and then store it back to X or it means
X=X+1. There is no need to assign X++ to X;
I think try the code without using the
X++ shorthand and I believe your scores should update correclty.
In regards to the return statement. In this specific case you don’t need a return statement because you’re not trying to get the the function to return something and use it elsewhere. Here, the function is updating 2 global variable (variables that were declared outside the function) and so all updates you do in this function will hold and no explicit return value is needed since you’re not using the return value for anything.
I hope this helps! if you have any questions - feel free to reply and I’ll answer as best as I can.