Do you start files with a leading ; just in case (of concatenation, where the file otherwise would start with one of `([+-/`)?
Do you use ; at end of var declarations? If not, beware; if so, do you use comma-first? Thanks for answers, just curious.
Do you use ; at end of var declarations? If not, beware; if so, do you use comma-first? Thanks for answers, just curious.
var foo = 1
var bar = 2
Is there an issue with semicolon-free var declarations that I should be aware of?About the concatenation, we use Browserify which bundles our code for us. The beginning of a Browserify bundle is a definition for the `require` function.
var foo = 'bar',
baz = 'bletch'
(function (global) {
//module pattern code here ...
})(this);
then you have trouble. Semicolons are not optional (meaning always optional, you can leave them out at will). Please read my blog post. var foo = 'bar'
var baz = 'bletch'
void function (global) {
//module pattern code here ...
})(this)Now is:
module.exports = function(){}; var a = 2
,b = "tan"
,c = "gent"
;
Keeps the var block distinctly visible in a function and in case you add a new variable there's only one line diff.always var foo = 'bar';
If you do comma first, I will automatically assume you're an idiot.
Two, stop making stupid assumptions.