title: This scoping in java script
body: <p>I know <code>this</code> keyword is evaluated on the basis of how a function is called. I have the following code:</p>
  <pre><code>name='sohan';
  income=23232;
  class Person{
      constructor(name,income)
      {
          this.name=name;
          this.income=income;
      }
      print(){
          console.log(this.name);
          console.log(this.income);
      }
      getFunc(){
          return this.print;
      }
  }
  
  let p1=new Person('bhavuk',10000);
  let print=p1.getFunc();
  print();
  </code></pre>
  <p>My doubt is <code>print()</code> should bind this to the global context. I expect 'sohan 23232', but it gives error <code>name undefined</code>. Please explain how is this working out. Thanks.</p>