This function is declared in an alternative JavaScript Design Pattern called "Immediately Invoked Function Expression", or more commonly, IIFE.
Immediately-invoked function expressions can be used to avoid variable hoisting from within blocks, protect against polluting the global environment and simultaneously allow public access to methods while retaining privacy for variables defined within the function.
This isn't necessary for Angular apps, but it is a common practice used by many JavaScript developers.
The first set of Parenthesis enclose the entire function block as an anonymous function. The second, empty parenthesis serve to invoke the anonymous function, hence the common confusion that it is "self executing". In essence, the anonymous function performs the task of defining the inner function, then the invocation ensures the definition is actually processed.
As others have stated, the main reasons to define a function in this manner is to isolate the code, and to ensure that 'use strict';
is only applied to the function, not the global scope. Though, in this limited example, the pragma 'use strict;'
is serving a very limited purpose.