4 ms·
I see these warnings a lot, but I work on a team that does not ever use semicolons, and hasn't for years. It is simply not a problem, I don't know what else to
by serve_yay 12y ago
I see these warnings a lot, but I work on a team that does not ever use semicolons, and hasn't for years. It is simply not a problem, I don't know what else to say. And I have come to really dislike the syntactic noise the semicolons add.
- BrendanEich 12y agoDo 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.
- fakhruddin 12y agoI prefer to use it like this -> 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.
- anon4 12y agoI like putting a semicolon on every third and fifth line, but omitting it on every fifteenth line and on leap years.
- serve_yay 12y agoWe don't use semicolons at all. We do use comma-first! 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.
- mavdi 12y agodon't use a leading ; always var foo = 'bar'; If you do comma first, I will automatically assume you're an idiot.
- b_hell_t 12y agoI use var foo = 'bar'; but at my place of work they insist on no semi-colons and comma first. I want to tell them this is stupid but I need solid facts. anyone care to expand.
- BrendanEich 12y agoIf you happen to write 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.
- jedschmidt 12y agoI wish `void` would get more love for IIFEs instead of just sitting there in a dark corner of JS, unloved. var foo = 'bar' var baz = 'bletch' void function (global) { //module pattern code here ... })(this)
- Havvy 12y agoAlmost perfect, but you left an unmatched close parenthesis before the call operator.
- mavdi 12y agoThis is a good example! It will try to run 'bletch' as a function. awesome.
- ttty 12y agoWho still writes this in 2015? Now is: module.exports = function(){};
- joliss 12y agoI use a semicolon-free style (only protecting leading ([+-/) with var declarations like so: var foo = 1 var bar = 2 Is there an issue with semicolon-free var declarations that I should be aware of?