title: Wrapping an arrow function inside a normal function
body: <p>My goal is that I'm trying to pass the <em>this</em> context from a normal function to an arrow function but I keep getting undefined.</p>
  
  <p>I know that <em>this</em> in a normal function behaves dynamically and determined by how the function was called. The <em>this</em> inside an arrow function follows lexical scoping rules to determine its value. However, when I call printWrapper() on line 16, <em>this</em> is set to the car object, so when I further call printThis(), as per the lexical scoping rules, it should print the car object, but in my case the <em>this</em> object being printed on line 2 is the global object.</p>
  
  <pre><code>printThis = () =&gt; {
    console.log(this); // prints the global object
  }
  
  var car = {
    year: 2015,
    printThis: printThis,
    printWrapper: printWrapper
  }
  
  function printWrapper() {
    console.log(this); // prints the car object
    printThis();
  }
  
  car.printWrapper();
  </code></pre>