Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var myvar;
- geocoder.geocode({'latLng': latlng}, function(results, status) {
- // this callback is triggered when the geocoding function is done.
- // So, it's guaranteed that myvar is filled (unless there was some kind of error)
- myvar = results[1].formatted_address;
- console.log(myvar);
- });
- // the next line not guaranteed to work, since the geocoding function might not
- // have been finished when this line is processed, so, myvar could be empty.
- console.log(myvar);
Add Comment
Please, Sign In to add comment