Have a simple function for init. lon and lat coordinates and this function returns the object with them.
function initPosMethod() {
if (navigator.geolocation) {
return navigator.geolocation.getCurrentPosition(initKoord);
}
}
function initKoord(position) {
var koordObj = {
lan:position.coords.latitude,
lon:position.coords.longitude
};
return koordObj;
}
initPosMethod();
So my question is, how it is possible, to get access to the 'koordObj'?
This is not working:
alert(initPosMethod.koordObj.lan);