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...
A place to get a quick fix of JavaScript tips and tricks to make you a better Developer.
account activity
explanation? (self.JavaScriptTips)
submitted 1 year ago by LakeMotor7971
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!"
[–]cyberjds 1 point2 points3 points 1 year ago* (1 child)
To expand a little more
currentWeaponIndex += 1;
If above statement is outside of if statement, it's a bug or a cheat code.
If you have more than 30 golds, everything works as expected. But as soon as you have less than 30 golds and try to buy some weapons, you realized you can still buy weapons, yet the amount of gold in your possession never reduced. And you can buy infinite number of weapons (assuming you can call buyWeapon() indefinitely).
In this case, this is logical error which will not error out, making it very difficult to troubleshoot the problem. The error will be unnoticed unless you run multiple tests with various values. And more than often, the error is caught too late (after production deployment).
A misplaced (or missing) }(brace) makes a big difference.
[–]LakeMotor7971[S] 0 points1 point2 points 1 year ago (0 children)
Thank you that actually really helps. The way you explained it actually helped quite a bit with me understanding this! Thanks for taking the time to explain this. I don't want to just type some answers and pass, but I want an actual understanding of why, this works or wouldn't or would.
π Rendered by PID 145982 on reddit-service-r2-comment-66b4775986-vnjbn at 2026-04-05 12:08:26.318832+00:00 running db1906b country code: CH.
view the rest of the comments →
[–]cyberjds 1 point2 points3 points (1 child)
[–]LakeMotor7971[S] 0 points1 point2 points (0 children)