-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comma-first vars should be encouraged. #195
Comments
While I agree that it is clearer and easier to find missing commas, this is not a universally accepted axiom of the JS community. Plus, there are even differences in opinion within the pro-comma group. I'd argue that the odd spacing would be cumbersome and just easier to write: var a = 1
, b = 2
, c = 3; and I'd include spaces between So as much as I like comma-first, I can't say that as a whole Idiomatic should be evangelizing such a polarizing style. |
Well, in my case I believe both are bad options, I think multiple var statements is the way to go, Ben Alman post cleared my mind. And like him, I've never heard a clear case that a single var statement is better than multiple despite being "pretty". |
I agree with @leonardolessa, here is a good article about not using single var. |
I agree with @leonardolessa @LiamKenneth, because programmers are not minimizer&optimizer |
It says "Any project that cites this document as its base style guide will not accept comma first code formatting", yet I have found comma-first is the best way if you don't want multiple var statements
For example:
will easily make a global variable c, which is likely not intended.
This style:
is more obvious when a comma is missing - causing a global variable to be created.
The text was updated successfully, but these errors were encountered: