title: Difference between these two types of self executing function on JavaScript
body: <p>I always use the following self executing function in order to avoid exposing my code to global scope in JavaScript:</p>
  
  <pre><code>(function() { 
      //Code comes here
  })();
  </code></pre>
  
  <p>I believe that this is also called <em>self executing anonymous function</em> as well. Sometimes, I also see the below code used for the same purpose:</p>
  
  <pre><code>(function(d){
      //Code comes here
  })(document.documentElement);
  </code></pre>
  
  <p>I am not sure what makes the difference here so I am asking this question.</p>
  
  <p>What is the difference (or are the differences) between these two types of self executing function on JavaScript?</p>