Re:Every line of code is always documented
by meistro on Saturday February 08, 2014 @02:42PM
(#7202293)
> var one = "foo"
Agree with the author that this is easier to change, and in JS it will keep you from accidentally leaving a trailing comma. That being said, I find it to be very unreadable(which is where most your time will be spent) and most text editors/IDE's make it a burden to work with.
[ Parent
| on HN ]
Re:Every line of code is always documented
by sonnym on Saturday February 08, 2014 @03:31PM
(#7202549)
While I agree with making code editable in single lines as much as possible, I think this is a particularly bad example. I do prefer the comma first style for arrays and objects, but not for variable declarations. I used to use this exact style a couple years ago, but now I prefer to explicitly declare every variable with `var` to prevent any possible, syntactically correct, error that would result in a global variable.
Re:Every line of code is always documented
by ryanpetrich on Sunday February 09, 2014 @12:48AM
(#7204551)
It's even easier to create three separate var statements and let a JavaScript compressor handle it:
var one = "foo";
var two = "bar";
var three = "baz";