Why are parenthesis used to wrap a javascript function call?

Viewed 13438

What is the difference between these two javascript function calls?

(function(){alert("foo")})()

versus this:

(function(){alert("foo")}()) 
2 Answers
Related