Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created April 21, 2011 17:13
Show Gist options
  • Save phiggins42/935015 to your computer and use it in GitHub Desktop.
Save phiggins42/935015 to your computer and use it in GitHub Desktop.
// not sure I like:
!function(a, b){ /* ... */ }(1, 2);
// over:
(function(a, b){ /* ... */ })(1, 2);
@HelloGrayson
Copy link

never seen the first one. based on general knowledge, i'd say the second is best. The bash symbol reminds me of ruby's function implication meaning you're going to be altering the object in question immediately, so I suppose it's appropriate here (firing immediately).

@phiggins42
Copy link
Author

i see it as trading readability for a single byte saving. The ! to me means "not", at least in js. The latter example reads to me: "this wrapped function" then "execute with these args passed".

seeing

... }(1, 2)

hurts my brain.

@HelloGrayson
Copy link

agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment