The only difference I can think of is if you assigned a variable to a function inside the first set of brackets, you will get different results depending on the grouping.
var test; (test = function(arg) { console.log(arg) })('I am the argument!')
This works as expected: it assigns a βtestβ function, then runs it once with an argument in the second set of parentheses. This is the same as setting up a test and then running it with test('I am the argument!')
But what about the other way?
var test; (test = function(arg) { console.log(arg) }('I am the argument!'))
test - undefined! What for? Because when you put parentheses next to a function, it calls the function before and then assigns it to a variable. If you complete the assignment in parentheses , then run it (example 1), then it will be convenient for you to go.
source share