0

I often use the closure syntax

var something = (function () {
  //TODO: do something 
}());

and, I often find people use this syntax

var something = (function () {
  //TODO: do something
})();

If both the two behaves the same way, what are the differences between the two?

isnvi23h4
  • 1,910
  • 1
  • 27
  • 45

1 Answers1

1

There's no real difference. Both statements contain function expressions that evaluate to functions that are immediately executed.

ide
  • 19,942
  • 5
  • 64
  • 106