How can I execute the function accept in updatePosition ? Why can denyexecute itself but not accept ?
accept = alert(123);
deny = alert(123);
function getLocation(accept,deny) {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
updatePosition(position, accept);
}, deny);
} else {
deny;
}
}
function updatePosition(position, accept) {
PositionLat = position.coords.latitude;
PositionLon = position.coords.longitude;
accept;
}
Put
()after the name.It can't. You are passing
denyas an argument tonavigator.geolocation.getCurrentPosition. The code innavigator.geolocation.getCurrentPositioncalls it.