You don't even need parentheses. The whole idea of these parentheses is to make the function be expression , not a declaration. You can also achieve this as
!function() { }();
This exclamation mark may also be + or - and some other characters. So it doesn’t matter if you use the “dog balls” option (your last) or not. In terms of performance, I can’t guarantee, but I'm 99.9% sure that there is zero difference (maybe it depends on the engine at best).
So, if we assume that there is no difference in performance between the two, this is an almost personal preference that you use. Crock has stated the second version many times as "dog balls" because you no longer wrap this expression. I would agree to that. As mentioned earlier, a template simply calls an expression of a function, and it must encapsulate it all for better readability.
jAndy source share