My goal is to access the API data from a fetch, and use it outside the function it was called in.
Here is an example of what I am trying to do. If I can never use the data from an async function outside of the function, does that mean that I can only use the data inside getWeatherData if I write more code inside getWeatherData? I plan to make other API calls, and I imagine that continuously nesting async functions to access data is not the right way to go about this.
Advice on how to resolve this is greatly appreciated!
I have tried the fix from this question How can I return the fetch API results from a function?, and tried returning data without JSON.stringify or JSON.parse as well as adding await to those steps.