4 ms·
I use semicolons when they're needed (for loops, multiple statements per line), and don't use them when they're not. The code becomes cleaner to my eyes.
by marcuswestin 16y ago
I use semicolons when they're needed (for loops, multiple statements per line), and don't use them when they're not. The code becomes cleaner to my eyes.
- gnaritas 16y agoThey're always needed so the JavaScript can be run through a compressor for production deployment without breaking the code. Beyond that you're using curly braces when they're not strictly required, which seems inconsistent. I would expect either both all the time or both only when strictly necessary.
- timknauf 16y agoSurely if the language specification calls semicolons optional then any compressor worth its salt should honor that? The YUI Compressor, at least, copes with semicolon-devoid Javascript just fine.
- gnaritas 16y agoThat's the sufficiently smart compiler argument. The fact remains you have more options available to you for minifying if you don't consider semi-colons optional, naming one compressor that can deal doesn't change the fact that most can't.