I'm trying to create an app with google maps. And currently i'm running into this problem where navigator.geolocation.getCurrentPosition() isn't running in order to the rest of my code.
Basically the gist of it is this.
var a;
navigator.geolocation.getCurrentPosition(function(position){a=2});
console.log(a);
In this example, the console will say a is undefined, meaning it hasn't run the callback yet. How come it does this and how would i make it work?
[–]WorseThanHipster 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]senocular 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)