Re:$.answer=42
by uxp on Saturday April 12, 2014 @09:13PM
(#7579798)
It has nothing to do with jQuery, or anything else. (function() {})(); is a pretty standard Javascript pattern to execute an anonymous function immediately at evaluation. Because javascript has lexical scoping at the function, your use of "use strict"; and any var-prepended variables won't be hoisted up the prototype chain, potentially becoming globals. The ability to pass in a global as a local variable is simply a convenience. The global is available inside the closure anyways. It's a global after all.
My point was, the battle over the dollar sign single character variable name is stupid.
My point was, the battle over the dollar sign single character variable name is stupid.