Why is this NaN to javascript?
<p>This is the main code to execute:</p>

<pre><code>for(var i = 0; i &lt; data.length; i++){
                console.log("data"+i)
                console.log(data);
                if(data[i].kind) removeMarkers(data[i].kind);
                addMarkerAndInfoToPOI(data[i]);
                console.log("nav to: "+data[i].lat+" "+data[i].lon);
                navigateToPoint(data[i].lat, data[i].lon);
            }
</code></pre>

<p>I have this object printed with <code>console.log</code></p>

<pre><code>Array[1]
    0: Object
       address: "blablabalbala"
       datatype: "Location"
       icon: "cafetaria"
       id: "/mensa/wo_mensa1_turm.std.php"
       kind: "Mensa"
       lat: 50.777016
       lon: 6.080348
       sortkey: "zeltmensa, forum cafete"
       stationId: "/mensa/wo_mensa1_turm.std.php"
       title: "Zeltmensa, Forum Cafete"
       type: "Mensa"
</code></pre>

<p>But <code>console.log("nav to: "+data[0].lat+" "+data[0].lon);</code> gives me <code>undefined undefined</code>, and at another point NaN NaN.. I don't understand this. It also doesn't let me use any other attributes like <code>data[0].address</code>, which returns <code>undefined</code> aswell.</p>

<p>Thanks for help.</p>

<p>EDIT: here it prints <code>pos:(50.77633849999999, 6.095257100000026) end(NaN, NaN)</code> </p>

<pre><code>function navigateToPoint(lat, lng){
    showBusyMessage();

    if(navigator.geolocation) {
        navigator.geolocation
            .getCurrentPosition(function(position) {
                var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude),
                    end = new google.maps.LatLng(lat,lng);
                console.log("pos:"+pos+" end"+end);
                displayRoute(pos, end);
                removeInfoWindows();
            }, function() {
                handleNoGeolocation(true);
            });
    } else {
          // Browser doesn't support Geolocation
          handleNoGeolocation(false);
    }
}
</code></pre>
