title: TypeScript - static property creation optimization
body: <p>I'm new to JavaScript and since I come from strongly-typed languages I've chosen TypeScript. </p>
  
  <p>I'd like to know what happens to variable <code>red</code> in <code>Red getter</code> in this code. Will it be recreated on every call (like in <code>Green getter</code>) or created once and used every time? Which is best?</p>
  
  <pre><code>class Color {
      public R: number;
      public G: number;
      public B: number;
      public A: number;
  
      static get Red(): Color {
          var red = new Color(255, 0, 0);
          Color.Red = function() { return red; }
          return red;
      }
  
      static get Green(): Color {
          return new Color(0, 255, 0);
      }
  
      constructor(red: number, green: number, blue: number, alpha: number = 255) {
          this.R = red;
          this.G = green;
          this.B = blue;
          this.A = alpha;
      }
  }
  </code></pre>