Re:Best Practices Exist For A Reason
by chc on Wednesday May 02, 2012 @06:07PM
(#3921460)
You can only put var at the beginning of variable declarations, but there are many other places that commas are used as a separator. So that "solution" doesn't apply in general.
[ Parent
| on HN ]
I think I might have explained myself poorly. I'm suggesting using separate var statements for each assignment, e.g.:
var a = 2; var b = 4; var c = { blah: "whatever" };
Leaving out a semicolon has no effect. They can be copied without any fuss. It's easy.
Re:Best Practices Exist For A Reason
by ricardobeat on Thursday May 03, 2012 @12:22AM
(#3922368)
Problems with semi-colons usually arise in object usage. So your solution is very specific.
x = {[
{ id: 1, data: 0 },
{ id: 2, data: 0 }
],
[
{ id: 3, data: 0 },
{ id: 4, data: 0 }
]}