The function is immediately executed; you are not executing it by calling it.
This is the definition of a function literal, followed by two parens parameters, which calls this function to be called immediately. Read more: Expression of Expressed Function (IIFE)
No matter what code you put inside, it runs immediately. Everything that is placed in paired calls is passed to the function as an argument. Assuming your code sample has been defined in the global scope, this is a window object and calls it global in the function body. This is a great way to encapsulate your programs to avoid variable conflicts, forced mode, and more.
Jaulde
source share