1

What is - if there is any - the difference between these two pieces of code:

(function(){
  // code
});

AND

(function(){
  // code
})();
yossi
  • 3,090
  • 7
  • 45
  • 65
  • Have a look here: http://stackoverflow.com/questions/3384504/location-of-parenthesis-for-auto-executing-anonymous-javascript-functions – hffmr Sep 09 '14 at 08:26
  • 3
    The first one defines an anonymous function, the second one also executes it immediately after. – raina77ow Sep 09 '14 at 08:27
  • 3
    Given `f = function () { /* .. */ }`, it's the same difference as `f` vs `f()`; only the latter actually executes the function. – user2864740 Sep 09 '14 at 08:28

0 Answers0