title: Typescript: variable value undefined despite being initialized in constructor
body: <p>I have <code>num1: number</code>, then </p>
  
  <pre><code>constructor(){
    ...
    this.num1 = 0;
  }
  </code></pre>
  
  <p>inside a class.</p>
  
  <p>But when log inside a function <code>console.log(this.num1)</code> or <code>console.log(typeof this.num1)</code>, I get <strong>undefined</strong> both times.</p>
  
  <p>Why is the value of my variable undefined here?</p>