3 ms·
I 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
by b_hell_t 12y ago
I 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(){};