Great article, helped me a lot to understand this concept! 👍👍
One question: suppose this fetch() call is inside a function. How would I return the JSON object from that function back to the main JS area where I made the call to the function? I tried a "return a;" just after the "console.log(a);" but that didn't work. Then I tried "return printAddress();", which didn't work either.
Any help? 😳
Freelancer, Full-stack developer (React.js / React Native / TypeScript / Node.js). I've come to specialize in developing Dashboards, Administrative Panels, CRM systems, and similar apps.
I'd say that the only way to get this JSON object outside the fetch() call is to assign it to a variable. If you could provide your piece a code it would be easier to understand and to help:)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article, helped me a lot to understand this concept! 👍👍
One question: suppose this fetch() call is inside a function. How would I return the JSON object from that function back to the main JS area where I made the call to the function? I tried a "return a;" just after the "console.log(a);" but that didn't work. Then I tried "return printAddress();", which didn't work either.
Any help? 😳
I'd say that the only way to get this JSON object outside the fetch() call is to assign it to a variable. If you could provide your piece a code it would be easier to understand and to help:)