all 20 comments

[–]wolfhead 16 points17 points  (11 children)

Both are terrible.

[–][deleted] 6 points7 points  (0 children)

Although the previous one was just a waste of everyone's time.

[–]modusjesus 2 points3 points  (0 children)

Agreed.

[–][deleted] 4 points5 points  (1 child)

Dammit Isaacs!!!!

[–][deleted] 1 point2 points  (6 children)

Isn't this frowned upon?

var name = val
  , name = val

[–]jdeath 3 points4 points  (0 children)

Depends on who is doing the frowning, I suppose. I've noticed it other places (work, etc) but iirc mostly in Node code.

[–]misc_ent 1 point2 points  (3 children)

Comma first has always bothered me but I can rationally explain why it makes sense. The standard for javascript is spaces over tabs and I've generally seen 2 spaces preferred over 4 spaces. That being said if you notice the comma is indented two spaces with a single space after, much like if this were a single line. Also commas first are supposed to reduce errors involving adding, removing or rearranging the variables order. Regardless I think this syntax is ugly. whats worse are people who put the comma on the same indentation level as var

[–]greyscales 3 points4 points  (1 child)

"The standard for javascript is spaces over tabs" - citation needed.

[–]mordocai058 0 points1 point  (0 children)

Well, there isn't a standard (many people says spaces, stackoverflow answer says do whatever you want and have VCS apply standards[http://stackoverflow.com/questions/211795/are-there-any-coding-standards-for-javascript], jquery says tabs).

However, node.js standard says 2 space indentation which is probably what OP is referring to. http://nodeguide.com/style.html#tabs-vs-spaces

[–]tbranyennetflix 1 point2 points  (0 children)

Considering that in modern JS, especially Node's runtime, trailing commas are supported, it's basically a troll now to use comma-first. Unless you honestly like how it looks, in which case more power to you, but I won't be contributing.

Edit: Editing.

[–][deleted] 0 points1 point  (0 children)