Good day,
I am still learning JS and HTML and I noticed something quite interesting for me
I am using Google Geocoding scripts and created an on click event on the map to retrieve the GPS co-ordinates,
function onClickCallback(event){
var str = event.latLng.toString().slice(1,-1).split(',', 2);
var lat1 = parseFloat(str[0]).toFixed(5);
var lng1 = parseFloat(str[1]).toFixed(5);
var latlng1 = new google.maps.LatLng(lat1,lng1).toString().slice(1,-1);
document.getElementById('latlng').value = latlng1;
this works perfectly for my needs however for some odd reason the second part "lng1" does not round down as expected and as an example the below is the result
-25.3341, 27.64984000000004 or -25.34403, 27.97393999999997
as the first part 'lat1' works fine what is the reason or cause for the second part 'lng1' not rounding and only displaying the first 5 decimals and how can I fix it