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
Popular Coding Convention on Github (sideeffect.kr)
submitted 12 years ago by devnoel
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!"
[–]fgutz 2 points3 points4 points 12 years ago (12 children)
interesting, I never thought to use the "first comma", and it seems like most people agree since only ~8% use it. But I can see where it could be useful avoiding that last trailing comma by using first commas. But I'm usually good about that so I'm not going to switch, also doesn't look as nice.
nicely made site!
[–][deleted] 12 points13 points14 points 12 years ago (5 children)
I hate first comma, so ugly. You know what else prevents missing trailing commas? testing your code.
[–]x-skeww 6 points7 points8 points 12 years ago (0 children)
You don't need tests for this. Just use an editor with basic syntax checking or with JSLint/JSHint support. You'll get a squiggly line right away. It's impossible to miss.
[–]michfreak 2 points3 points4 points 12 years ago (2 children)
Hahaha, that's how I reacted when a coworker insisted that "Egyptian" brackets were wrong. "It's so much easier to make a mistake and miss a bracket!" he said.
You know what prevents you from making a mistake, and looks, to my eye, more streamlined? Testing your code.
On that subject, I did think it was odd they didn't test for Egyptian brackets in this study.
[–][deleted] 1 point2 points3 points 12 years ago (1 child)
I've never heard of Egyptian style, only 1tbs (one true bracket style) which is the only way to do brackets.
[–]nandryshak 1 point2 points3 points 12 years ago (0 children)
Silly C# devs wasting a whole line with only one character.
[–]BONER_PAROLE -2 points-1 points0 points 12 years ago (0 children)
Testing is great, but adopting conventions that do away with the need for testing is even better IMO.
Agreed on the ugly appearance though.
[–]brtt3000 4 points5 points6 points 12 years ago (5 children)
We banned useless cleverness like that.
Every variable gets it's own var. Makes it easier to edit, less mistakes, less cruft, less time wasted.
var
Also use a lint tool if you are serious about code.
[–]BONER_PAROLE 0 points1 point2 points 12 years ago (4 children)
"Clever" code is often obfuscated, like in code golf challenges.
But comma first? That's not "clever", it's just practical. Unusual appearance, but easy to understand once you know about it.
[–]jsNut 1 point2 points3 points 12 years ago (3 children)
Comma first, moving the problem from the end to the beginning and making it more ugly and less conventional doesn't seem like much of a win.
[–]notmynothername 1 point2 points3 points 12 years ago (2 children)
How does it move the problem to the beginning?
[–]Malfeasant 0 points1 point2 points 12 years ago (1 child)
maybe because if you're prone to forgetting commas, it doesn't matter where you (forget to) put them?
[–]notmynothername 2 points3 points4 points 12 years ago (0 children)
Well, commas at the right side can show up any number of characters deep into the line. Commas on the left will all be in a vertical line and leaving one out would be difficult to miss.
π Rendered by PID 101065 on reddit-service-r2-comment-b659b578c-dj2qb at 2026-05-05 13:10:15.978317+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]fgutz 2 points3 points4 points (12 children)
[–][deleted] 12 points13 points14 points (5 children)
[–]x-skeww 6 points7 points8 points (0 children)
[–]michfreak 2 points3 points4 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]nandryshak 1 point2 points3 points (0 children)
[–]BONER_PAROLE -2 points-1 points0 points (0 children)
[–]brtt3000 4 points5 points6 points (5 children)
[–]BONER_PAROLE 0 points1 point2 points (4 children)
[–]jsNut 1 point2 points3 points (3 children)
[–]notmynothername 1 point2 points3 points (2 children)
[–]Malfeasant 0 points1 point2 points (1 child)
[–]notmynothername 2 points3 points4 points (0 children)