I’m having trouble properly passing planetary data from scriptHelper to script.js.
I only get an undefined response, so I’m pretty sure that it’s that I’m not sending what the function wants, if anything at all.
(having read some help threads got me onto that as being the problem)
since passing the json array of planet data into pickPlanet seems to work just fine, that’s how I started. but that’s not what it wants.
So after rereading everything and testing various ways to manipulate my response, I still can’t find a way to actually pass any data at all into the script function that displays the planets in JS per the instructions.
I’ve tried returning json, returning planetsReturned, and lastly now returning the entire response.json().then function because that’s literally what it says to do in the instructions.
No dice, nothing I’ve tried works.
I’ve tried restructuring and rebuilding json object as an array and passing that with the result that it’s not passing anything through. undefined undefined undefined.
I’m feeling incredibly stupid and desperate at this point.
My main question is:
What is it expecting? If I knew what it wanted I could at least hard code something for a test and then work out a solution.
It doesn’t want the one planet because the instructions say that it will populate a list like I can do with an iteration script. it isn’t iterating there, they’re just bare console.logs.
I have listedPlanetResponse set equal to myFetch() per the instructions.
Maybe I have that wrong, but I’ve seen someone doing that already and they seem to be on the right track. What it looks like is that it’s reproducing the fetch line before response.json, so returning the entire response.json function, should just work, but it doesn’t.
It doesn’t work if I pick apart the response.json…then function assigned out to a variable then calling the variable.
I at least figured out that I could separate out the actual promise and response thread that shows it fulfilled before displaying any json data, but that seemed pretty useless too.
I can call everything inside myFetch and build the get the whole thing to display properly and work, but it will never pass the grader lol. I can’t figure out why the data won’t go to the next page over lol.
I can get whatever sending to addDestinationInfo without undefined showing up but there I get the type error that what I’m sending is undefined so I think it’s not really any better.
Also maybe important, both DestinationInfo and formSubmission are giving me reference errors–module not defined which I’m catching,
I’m hoping that’s not contributing anything. I’ve been getting them since I started the assignment and handling the error, so they don’t seem to be doing anything terrible but I’m not sure. FormSubmission works fine so far so not sure why there’s an error there.
So to sum up-what in tarnation does script.JS want?
any and all help appreciated. Thanks for reading!