var a = function () { return 'test'; }(); console.log(a);
The answer in the first case: test
var a = (function () { return 'test'; })(); console.log(a);
The answer in the second case: test
I use the first approach to create independent functions. However, I have seen a second approach. Is there a difference in the two approaches? The result is obviously the same.
source share