JavaScript Self Executing Functions - What's the Difference?
Posted
by
modernzombie
on Stack Overflow
See other posts from Stack Overflow
or by modernzombie
Published on 2011-11-22T17:27:30Z
Indexed on
2011/11/22
17:50 UTC
Read the original article
Hit count: 148
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);
© Stack Overflow or respective owner