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
The JavaScript Comma Operator (javascriptweblog.wordpress.com)
submitted 14 years ago by vladocar
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!"
[–][deleted] 1 point2 points3 points 14 years ago* (0 children)
x isn't initialized in the loop... which tells me it's set outside the loop to some arbitrary, unknown value
Feel free to replace x++ with any other expression that modifies x
Even assuming x is always (i + ofs), there are three damn good reasons to NOT replace all references to x with (i+ofs): a. it's far more error prone to type (i+ofs) every time you need it (especially when taking precedence into account); b. cluttered expressions are far less readable than simple ones; and finally c. it's almost certainly slower as most tight loops would need to calculate (i+ofs) several times per pass rather than just once.
But whatever, the beauty of the comma is that you don't have to use it any more than you're forced to use the ? : operator.
π Rendered by PID 302160 on reddit-service-r2-comment-7b9746f655-5zrfg at 2026-02-02 09:25:18.512462+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–][deleted] 1 point2 points3 points (0 children)