title: Typescript: How to access "two levels above" properties
body: <p>Quick question - How to access "two levels above" properties? 
  Testing example in TypeScript:</p>
  
  <pre><code>export class Test {
      testVariable: string;
      constructor() { }
  
      TestFunction() {
          MyFunctions.Proxy.Join() { //some made up function from other module
              //HERE
              //How can I here access testVariable property of Test class?
          }
      }
  }
  </code></pre>
  
  <p>Or is it even possible to access such a properties in TypeScript (or JavaScript in general)?</p>
  
  <p><b>Edit + answer:</b> As my question was not clear enough I bring some new info about this issue. 
  It is very commonly asked question by starting programmers. </p>
  
  <p>Issue here is that <code>this</code> changes its context - firstly it refers to class Test, then it refers to my inner function - <code>Join()</code>. To achieve correctness we have to either use lambda expressions for inner function call or use some substitute value for <code>this</code>.</p>
  
  <p>First solution is in the accepted answer.</p>
  
  <p>Second is this:</p>
  
  <pre><code>export class Test {
      testVariable: string;
      constructor() { }
  
      TestFunction() {
          var myClassTest: Test = this;
          MyFunctions.Proxy.Join() { //some made up function from other module
              myClassTest.testVariable; //approaching my class propery in inner function through substitute variable
          }
      }
  }
  </code></pre>