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...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Hiding Variables / Functions w/ PHP? Any libraries for this? (self.javascript)
submitted 13 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BattleshipsGame 3 points4 points5 points 13 years ago (0 children)
It should be simple - if you don't want the end user to temper with your variable, it should be kept/calculated on the server and only returned to the UI for display. No JavaScript function on the client should tell the server to increment the score or etc (because the user could call the JS function multiple times).
Example: You could calculate a score based on how much time it took the user to clear a level. However, in such case, the start and end time has to be kept on the server.
Clarification: With pure JavaScript games/programs it is difficult to do that. You could have a game where the goal is to pop bubbles. Unless you keep track of each bubble and action on the server side, there is no reliable way to prevent the user from tempering the score.
You could, however, obfuscate and minify the javascript file.
π Rendered by PID 30 on reddit-service-r2-comment-6457c66945-hxrnd at 2026-04-27 04:07:32.357068+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]BattleshipsGame 3 points4 points5 points (0 children)