A long time ago, I saw someone encapsulate their entire JavaScript block with code something like the code below:
(function() {
// ...
})(this);
Questions:
- Is the code above correct?
- What benefit is there to encapsulating the entire JavaScript block like denoted above?