Very often, for libraries / functions / snippets, Javascript is encapsulated by an anonymous function, e.g.
(function () {
As far as I can tell, this should be completely redundant: this anonymous function simply executes the code inside. However, obviously, the reason for this !:-)
I saw the appearance of this with a comment next to the first line: //// wrapper for Opera.
Does anyone know why this code is commonly used, what is the history of its development and what is its relationship with Opera?
javascript
Bobby jack
source share