In jQuery javascript code I see
(function(window, undefined) {
})(window);
And in Twitter
!function(window, undefined) {
}(window);
Can someone tell what the difference between these two approaches is?
In jQuery javascript code I see
(function(window, undefined) {
})(window);
And in Twitter
!function(window, undefined) {
}(window);
Can someone tell what the difference between these two approaches is?
Using the ! operator before the function causes it to be treated as an expression, so we can call it:
!function() {}()
http://jasonlau.biz/home/faq/what-is-the-exclamation-mark-used-for-in-code