JavaScript Self Executing Functions - What's the Difference?
- by modernzombie
I am very familiar with self executing functions from working with jQuery.
(function($) { /* do stuff */ })(jQuery);
Today I was reading the backbone.js source and noticed that they do this:
(function() { /* do stuff */ }).call(this);
Is this achieving the same thing? Would the following 2 lines of code do the same thing?
(function($) { /* do stuff */ })(jQuery);
(function($) { /* do stuff */ }).call(jQuery);