OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Variable doenst change in async function pure Vanilla JS [duplicate]

  • Thread starter Thread starter Marco1314
  • Start date Start date
M

Marco1314

Guest
Can someone say me why my veriables (lat and lon) doesnt change?

Code:
    let lat;
    let lon;
    let fetchFunc =  async function () {
         let fetch_begin_for_LINK_API =  fetch(LINK_API+"&appid="+API_KEY);
         let result =  await fetch_begin_for_LINK_API.json();
         lat = result[0].lat;
         lon = result[0].lon;
        

}

<p>Can someone say me why my veriables (lat and lon) doesnt change?</p>
<pre><code> let lat;
let lon;
let fetchFunc = async function () {
let fetch_begin_for_LINK_API = fetch(LINK_API+"&appid="+API_KEY);
let result = await fetch_begin_for_LINK_API.json();
lat = result[0].lat;
lon = result[0].lon;


}
</code></pre>
 

Latest posts

Top