title: typescript: print only string from variable
body: <p>Coding ionic framework 2.</p>
  
  <p>I have a locationtracker, that is giving me the exact latitude and longitude of a person. </p>
  
  <p>I want to have ONLY the string printed from the storeArray, and not the number from the equation.</p>
  
  <p>How is it possible, to ignore the number, from the variable, and only print the store-name out?</p>
  
  <pre><code>    this.storeArray = [distValby, distKbhK, distRoskilde];
      this.storeArray.sort();
  </code></pre>
  
  <p>Sorted by lowest number by default.</p>
  
  <p>Fairly new to ionic 2 and typescript in all.</p>
  
  <p>Thanks!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import { StoreLocation } from '../../providers/store-location';
  import { Component, OnInit } from '@angular/core';
  import { NavController } from 'ionic-angular';
  import { LocationTracker } from '../../providers/location-tracker';
  
  @Component({
    selector: 'page-location',
    templateUrl: 'location.html'
  })
  
  export class LocationPage implements OnInit{
  
    public usrStoreLat: any;
    public usrStoreLong: any;
    public usrDistance: any;
    public storeArray: Array&lt;any&gt; = [];
  
    public roskilde: StoreLocation = new StoreLocation("Bagel Roskilde", "Trekroner st. 4", 55.650107, 12.131997, null);
    public valby: StoreLocation = new StoreLocation("Bagel Valby", "Valby Langgade 12", 55.668071, 12.497865, null);
    public kbhK: StoreLocation = new StoreLocation("Indre København", "Axeltorv 5, 1609 København V", 55.6887527, 12.5404156, null);
  
    constructor(public navCtrl: NavController, public locationTracker: LocationTracker) {
    }
  
    // START GEO TRACKING FOR NUVÆRENDE POSITION
  
    ngOnInit(){
      this.start();
    }
  
      public start(){
     this.locationTracker.startTracking();
      this.usrStoreLat = this.locationTracker.lat;
      this.usrStoreLong = this.locationTracker.lng;
  
      
      if(this.locationTracker.lat != null){
      console.log('Tracker nu!');
      console.log('person lokation lat:' + this.usrStoreLat);
      console.log('person lokation long:' + this.usrStoreLong);
      this.calculateDist();
      }
    }
  
  
    public calculateDist (){
      var distRoskilde  = ((this.usrStoreLat-this.roskilde.lat)+(this.usrStoreLong-this.roskilde.long)) + this.roskilde.name;
      var distValby     = ((this.usrStoreLat-this.valby.lat)+(this.usrStoreLong-this.valby.long)) + this.valby.name;
      var distKbhK      = ((this.usrStoreLat-this.kbhK.lat)+(this.usrStoreLong-this.kbhK.long)) + this.kbhK.name;
  
      this.storeArray = [distValby, distKbhK, distRoskilde];
      this.storeArray.sort();
      
      console.log('se:' + typeof(this.storeArray[0]) + this.storeArray[0].toString());    
      // console.log('store arrayet:' + this.storeArray[0]);
    }
  
    stop(){
     this.locationTracker.stopTracking();
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"&gt;&lt;/script&gt;
  &lt;ion-header&gt;
   &lt;ion-navbar&gt;
     &lt;ion-title&gt;
       Location Tracker
     &lt;/ion-title&gt;
   &lt;/ion-navbar&gt;
  &lt;/ion-header&gt;
  
  &lt;ion-content&gt;
   &lt;h4&gt;Current Latitude: {{locationTracker.lat}}&lt;/h4&gt;
   &lt;h4&gt;Current Longitude: {{locationTracker.lng}}&lt;/h4&gt;
  
    &lt;p&gt; Tætteste butik: {{this.storeArray[0]}} &lt;/p&gt;
  
   &lt;button ion-button full primary (click)="start()"&gt;Find nærmeste butik&lt;/button&gt;
   &lt;button ion-button full primary (click)="stop()"&gt;Stop Tracking&lt;/button&gt;
  &lt;/ion-content&gt;</code></pre>
  </div>
  </div>
  </p>