title: Why write ".call(this)" at the end of an javascript anonymous function?
body: <p>I have seen JavaScript written like this (it was at a demonstration, and I don’t have the actual code at hand, but it was implied this was normal):</p>
  
  <pre><code>(function() {    
  
      var a = 1;
  
      this.sayA = function() {
          alert(a);
      }
  
  }).call(this);
  
  sayA();
  </code></pre>
  
  <p>I suppose it is written an an anonymous function so that the variable <code>a</code> is not globally available.</p>
  
  <p>What could the point of the <code>.call(this)</code> be?  Since this function was not nested, <code>this</code> was just the window.  How does it differ from just writing <code>()</code> at the end?</p>