There's yet another common usage of functions, usually seen in popular libraries and frameworks, that lets you bring some modularity advantages from other languages into JavaScript (even the older versions!). The usual way of writing this is something like the following:
(function() { // do something...})();
You can also have the same style, but pass some arguments to the function that will be used as the initial values for its parameters:
(function(a, b) { // do something, using the // received arguments for a ...