!function(){ }() vs (function(){ })()

jamie_

New Member
While reviewing some of the code written in the Twitter Bootstrap Javascript, it looks like they're calling immediately invoked anonymous functions like this:\[code\]!function( $ ) { ...}(window.jQuery || window.ender);\[/code\]Where I've traditionally seen this same thing accomplished this way:\[code\](function($) { ...})(window.jQuery || window.ender);\[/code\]The first way seems a bit hacky, and I'm not sure if there is any benefit or reason for doing it this way rather than the second way? Note that I understand how it works, I'm looking to understand why they chose that way to do it.
 
Top