JavaScript doesn't seem to wait for return values

后端 未结 4 1356
我寻月下人不归
我寻月下人不归 2020-12-29 20:28

I\'ve been struggling with this for a while now. I\'m new to Javascript, and have been under the impression that the code I\'ve been writing has been running asynchronously.

4条回答
  •  醉酒成梦
    2020-12-29 21:08

    The return statement inside the anonymous function returns from the anonymous function, not from the outer geocode function. The geocode function returns undefined. The geocoder.geocode method may call the anonymous function whenever it wants, sync or async. Check the docs for it.

提交回复
热议问题