title: this inside iife points to window?
body: <p>Learning about <strong>this</strong> in JavaScript. I am confused about the scope of this inside iife. Why this points to window object inside iife? This should points to myObj because it is inside myObj.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>window.foo = "bar1";
  var myObj = {
     foo: "bar2",
     func: function() {
         var self = this;
         console.log(this.foo + ", " + self.foo);
         (function xx() {
             console.log(this.foo + ", " + self.foo)
         }());
     }
  }
  myObj.func();</code></pre>
  </div>
  </div>
  </p>
  
  <p>Output - </p>
  
  <blockquote>
    <p>bar2, bar2 <br/>
    bar1, bar2</p>
  </blockquote>
  
  <p>I am concerned about bar1 in second line.</p>