While reviewing some of the code written in the Twitter Bootstrap Javascript, it looks like they're calling immediately invoked anonymous functions like this:
!function( $ ) {
...
}(window.jQuery || window.ender);
Where I've traditionally seen this same thing accomplished this way:
(function($) {
...
})(window.jQuery || window.ender);
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.
!function(){}()
rather than(function(){})()
, not(function(){})()
vsfunction(){}()
. (In some cases, the last will cause a syntax error. Neither of the first two will.) – Sidon