There is no practical difference in those two forms, but from a grammatical point of view the difference between the two is that The Grouping Operator – the parentheses – will hold in the first example a CallExpression
, that includes the FunctionExpression
:
CallExpression | | FunctionExpression | | | V V (function() { }()); ^ ^ |--PrimaryExpression --|
In the second example, we have first a whole CallExpression
, that holds the FunctionExpression
:
PrimaryExpression | FunctionExpression | V (function() { })(); ^ ^ |-- CallExpression --|