What do you call these patterns? What is the difference between them? When would you use each? Are there any other similar patterns?
(function() {
con
(function() { 'use strict'; you can use this type
Why?: An IIFE-Immediately Invoked Function Expression removes variables from the global scope. This helps prevent variables and function declarations from living longer than expected in the global scope, which also helps avoid variable collisions.
Why?: When your code is minified and bundled into a single file for deployment to a production server, you could have collisions of variables and many global variables. An IIFE protects you against both of these by providing variable scope for each file.