Skip to main content
8 events
when toggle format what by license comment
Sep 23, 2013 at 0:42 vote accept riyoken
Sep 21, 2013 at 21:56 comment added dcaswell @plalx I fixed the "global" and up-voted your answer. Thanks!
Sep 21, 2013 at 20:42 comment added plalx @riyoken, Thanks! Make sure that you correct the scoping mistake in the answer you selected when you will implement the solution. _local1 is declared as global.
Sep 21, 2013 at 16:54 comment added riyoken these are both great answers.
Sep 21, 2013 at 14:51 comment added plalx @JeffVanzella, It all depends on the language being used. In JavaScript it's way more common to use a single var statement or at least declare the variables at the top of the function, despite variable hoisting. JSLint, one of the most popular JS code quality tool will complain about multiple var statements by default. Also, most popular librairies, such as jQuery adopted this coding practice as we can see here. There are perhaps cases where I tould tolerate it, but here there's no valid reason.
Sep 21, 2013 at 7:10 comment added Jeff Vanzella I disagree with declaring variables at the top of the function. I find it better to declare it closer to where it will be used. It is Accepted practice to do so
Sep 21, 2013 at 6:56 review First posts
Sep 21, 2013 at 7:11
Sep 21, 2013 at 6:38 history answered plalx CC BY-SA 3.0