title: Javascript: Wrap code in an anonymous function
body: <p>If I wrap my script in an anonymous style function like when Compiling in Coffeescript is appropriate to manipulate the DOM?</p>
  
  <ul>
  <li>What benefit does it have?</li>
  <li>What problem does this have?</li>
  <li>Is my code more secure?</li>
  </ul>
  
  <hr>
  
  <pre><code>(function() {
  
  this.detect = function(){
    window.alert( "message" );
  
  };
  
  }).call(this);
  </code></pre>