In my word game there is a scoring system which adds each correct word spelt.
I start by setting it to “0” in the “newGame” function like this
$('.score').html("0/" + completionNumber);
Completion number is the amount completed so this should show “0/0”, which it does when I run locally on a browser. But for some reason it displays “0/,,,0” when I run it on the server and I don’t know why.
When the correct word is spelt I add the new score with this line
$('.score').html(score.right + "/" + completionNumber).show();
And reset the score in “resetGame” function like this
$('.score').html("");
Can anyone help me or tell me if this has happened to them before?
EDIT**
Here is the script file in a fiddle… http://jsfiddle.net/smilburn/Z2JtD/
I did a quick check of your script and saw
completionNumber = [];I see that array is a global, and is accessed and set several times throughout the script. What’s happening, at some point, is your array looks likeSo when it prints, it displays as
I would consider an app re-structure to only set those globals after proper validation.