This is basically a congressional issue.
(function () {}()); <- one less stack frame before execution (possible)
(function () {})(); <- executed outside the bracket, so one small frame before execution, although I do not like this style, IMO it is visually disabled.
function () {}(); <- this is simply IMO wrong practice, it is not immediately obvious that this is IIFE , which is mainly due to agreement, but this problem also has a problem: if you forget the semi-colony before the expression, then in some conditions quietly set the variables to undefined.
Example:
var x = 0, y = 1, z = 3, function () { alert("Z is now undefined, instead of throwing a syntax error."); }();
Strike>
As mentioned by Andre Meinhold, this is not in the position of expression.
Lucas green
source share