I was looking at the jQuery plugins for Twitter Bootstrap and saw that they were all defined using a pattern like this:
!function($) {
// code here
// plugin definition here
} ( window.jQuery || window.ender);
This looks like a variation of the immediately executing anonymous function (anonymous closure):
(function($) {
// code here
}(jQuery));
Can someone explain what the Bootstrap variation does and why? Is this a better way to write an anonymous closure?
Thanks!
1 Answer