I'm assuming you using JavaScript in a browser and have the latitude/longitude values and are trying to create a string like "latitude, longitude" and want the numbers to use periods for decimal places. As you likely know some cultures use a comma as a decimal place instead. If you simply convert a number to a string in JavaScript it will be formatted based on the culture setting of the browser/device. For example:
var latitude = 45.001;
var longitude = -110.001;
var coordString = latitude + ', ' + longitude;
//The coordString value could be "45.001, -110.001" or "45,001, -110,001" depending on culture setting.
To better handle this and force the numbers to use a period for a decimal place, you can use the toLocaleString
function and set the culture to en-US
.
var latitude = 45.001;
var longitude = -110.001;
var coordString = latitude.toLocaleString('en-US') + ', ' + longitude.toLocaleString('en-US');
//The coordString value would only be "45.001, -110.001" regardless of the browsers culture setting.