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,778
  • 1
  • 24
  • 43

1 Answers1

1

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

ide
  • 18,381
  • 5
  • 58
  • 103