Guest User

Untitled

a guest
Oct 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. var myvar;
  2.  
  3. geocoder.geocode({'latLng': latlng}, function(results, status) {
  4. // this callback is triggered when the geocoding function is done.
  5. // So, it's guaranteed that myvar is filled (unless there was some kind of error)
  6. myvar = results[1].formatted_address;
  7. console.log(myvar);
  8. });
  9.  
  10. // the next line not guaranteed to work, since the geocoding function might not
  11. // have been finished when this line is processed, so, myvar could be empty.
  12. console.log(myvar);
Add Comment
Please, Sign In to add comment