title: Why does wrapping a callback in an anonymous function change the meaning of 'this'?
body: <p>If I have a method that uses the keyword <code>this</code>:</p>
  <pre class="lang-js prettyprint-override"><code>let myObject = {
      logThis: function(){
          console.log(this)
      },
  }
  </code></pre>
  <p>And I pass it to a <code>higherOrder</code> function:</p>
  <pre class="lang-js prettyprint-override"><code>function higherOrder(callback){
      callback()
  }
  
  higherOrder(obj.logThis)
  </code></pre>
  <p><code>this</code> will not refer to <code>myObject</code>, but to the object that calls <code>higherOrder</code> (in this case, the window object).
  I understand that this is because its execution context changes.</p>
  <p>what I <strong>dont</strong> understand is why when I wrap it in an anonymous function like this:</p>
  <pre class="lang-js prettyprint-override"><code>higherOrder(function(){myObject.logThis()})
  </code></pre>
  <p><code>this</code> will again refer to <code>myObject</code>. Isn't the execution context still changing?<br />
  If i'm passing it to a function that exists in the global scope, shouldn't <code>this</code> refer to the global scope?<br />
  I can't figure out why wrapping it in an anonymous function should change anything.</p>