When I read the javascript code which is clean and written by those that are obviously very good, then I Often see this pattern
var x = some.initialization.method (), y = some .els (), z; What is the benefit of the benefit of that writing
var x = some.initialization.method (); Var y = something.els (); Var z; The second format is easy to maintain, because each row exists by itself, then you can delete a line or add a line, and not to see if it The first or the last variable that is to be started is to be started. It also means that source control diffs / merges will work better. Given these losses, I think there is some benefit in the first format - but what is this? Of course they execute equally as it is similar to parser.
Javascript to be sent to the browser; Google will only compile a var version in 'whotspace' mode:
var x = some.initialization.method (), y = some .els (), z; and as multi:
var x = some.initialization.method (); Var y = something.els (); Var z; I changed your else to als so that it is compiled. This is not a large scale gain (especially if you are compressing files), and 'simple' compilation mode will do this for you anyway, so maybe I will not be too worried about it Unless you get more compelling reasons
One reason you do not do want to do this is that if you accidentally use a semicolon instead of a comma then you have been found to be a global one.
Comments
Post a Comment