Question: I'm trying to create markers on a google map using google's own API. My issue is that I'm reading JSON data from a text file then trying to break it down to the latitudes and longitudes so I can place markers on the map. You can see my code below.

```
var oReq = new XMLHttpRequest(); //New request object
oReq.onload = function() {
//This is where you handle what to do with the response.
//The actual data is found on this.responseText
//alert(this.responseText); //Will alert: the location latitude and longitude in JSON

locations = JSON.parse(this.responseText);
//alert(locations);
for(var i = 0; i < locations.length; i++ ){
    var tempLocation = locations[i];
    //alert(tempLocation);

    var tempLat = tempLocation.latitude;
    var tempLong = tempLocation.longitude;
    tempLat = tempLat.toString();
    tempLong = tempLong.toString();

    pictureLocations[i] = new google.maps.LatLng(tempLat + ", " + tempLong);  
}
    var tempPictureLocation = pictureLocations.toString();
    alert(tempPictureLocation);

};

```

My issue is that the variable pictureLocations returns NaN. I believe that their is something wrong with my constructing statement but not sure exactly what's wrong. If I hardcode in some coordinates it also doesn't work. Thanks for the help!

Answer: 
a [google.maps.LatLng object](https://developers.google.com/maps/documentation/javascript/reference#LatLng) takes **two numbers** as its arguments. This is not correct:

```
pictureLocations[i] = new google.maps.LatLng(tempLat + ", " + tempLong); 

```

should be

```
pictureLocations[i] = new google.maps.LatLng(tempLat,tempLong); 

```

and safer to be:

```
pictureLocations[i] = new google.maps.LatLng(
                            parseFloat(tempLocation.latitude),
                            parseFloat(tempLocation.longitude));

```

as coming from JSON, they are both strings. You could even verify they are valid numbers, by testing "isNaN" before using them to construct the google.maps.LatLng.
Google Maps LatLng constructor is designed for the arguement to have a comma between the numbers so it looks like this: `pictureLocations[i] = new google.maps.LatLng(tempLat, tempLong);`