10 ms·
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
by chc 15y ago
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.
- asolove 15y agoI 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.
- ricardobeat 15y agoProblems 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 } ]}