I have wrote a code that cuts off a latitude and longitude precisely by using sub string as the given result from google is a whole string of numbers, but when i search for a location in a map, however when I remove the console.log() from the function and then call it later on, it gives me an undefined result, excuse me for the bad english
code :
test = "(40.40926169999999, 49.86709240000005)"
function cutLat (string)
{
for (i=0; i<string.length; i++)
{
if (string[i] === "," && string[i+1] === " ")
{
string.substring(1,i);
}
}
}
function cutLng (string)
{
for (i=0; i<string.length; i++)
{
if (string[i] === "," && string[i+1] === " ")
{
string.substring(i+2,string.length-1);
}
}
}
console.log(cutLat(test))
