title: Geolocation with typescript
body: <p>I have the following code snippet:</p>
  
  <pre><code>pos:number;
  
  getPosition() {
      navigator.geolocation.getCurrentPosition((position) =&gt; {
  
          this.pos = position.coords.latitude;
  </code></pre>
  
  <p>when I debug I get undefined on this.pos, and some number on position.coords.latitude</p>
  
  <p>But when I have the following code snippet:</p>
  
  <pre><code>pos:any;
  
  getPosition() {
      navigator.geolocation.getCurrentPosition((position) =&gt; {
  
          this.pos = position.coords.latitude;
  </code></pre>
  
  <p>then the this.pos is set.
  Why such a behaviour ?</p>