Wrote the core JavaScript for my Space Search project: a live fetch to NASA’s Astronomy Picture of the Day API. Learned how fetch() and .then() chains work — sending a request, converting the raw response with .json(), then using the data to build the page. Handled the case where NASA sometimes posts a video instead of an image (using an if statement and a media variable so I only set innerHTML once, instead of overwriting it multiple times). Added error handling with .catch() so the page shows a clear message instead of going blank if something fails. Toughest part was understanding why setting innerHTML multiple times wipes out previous content — had to actually see it break before it clicked.
Screenshot: the page showing today’s NASA title, image, and description.
Ik that it isn’t looking cool but trust the process buddies TT
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.