This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Extract json data  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, i have this assignment from my school, and ive tried to solve it for hours now.. Im able to fetch the Json, but when i try and print the names i get undefined every time.
Don't know why, since IMO, ive declared the variables im trying to extract.

Best Regards.

Assignment

Execution in serial
Use fetch and async/await to complete fetchPerson(..)below. When implemented, each line in printNames() must be executed “sequentially”. Verify this with the debugger.



What i have so far

 
Marshal
Posts: 67191
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code on line 13 that calls fetchPerson expects the data to be returned from that function. Yet, looking at the code of fetchPerson reveals that there is no data returned.

Mystery solved.
 
Rune Halvor Jensen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, still returns undefined.



Output

Before
undefined
undefined
After all

 
Rune Halvor Jensen
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've fixed it. Thank you for your input.
 
You've gotta fight it! Don't give in! Read this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!