Wrapping a file with (function() { … }).call(this) versus a call with simply ()

Viewed 497

The backbone.js source code uses a function wrapper like this:

(function(){
    ...
}).call(this);

as seen at http://backbonejs.org/docs/backbone.html#section-185.

Much more often, I've seen the following used instead:

(function(){
    ...
})();

When does the behavior of these two differ? I was under the impression that they were equivalent, but I assume that there must be a difference given that Backbone uses .call(this) instead of the shorter alternative.

2 Answers
Related