please help with getting a right function or method to stop the setTimeout function.
I've been trying with the following codes but the setTimeout "loop" could not be stopped. What i'm trying to do is to get the user's current location every 5 seconds, and then when i press the stop button. It stops getting the location.
function geoTrackstart(){
//geolocation code
});
timer = setTimeout(geoTrackstart, 5000);
}
function geoTrackstop(){
clearTimeout(geoTrackstart);
timer = 0;
}