Skip to content

Conversation

HoussamLh
Copy link

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Title:

Add Programmer Humour XKCD Comic Project

Description:

This PR adds a small project that fetches and displays the latest XKCD comic using the API https://xkcd.now.sh/?comic=latest.

Features:

  1. Fetches the latest comic with fetch
  2. Logs the JSON response to the console
  3. Dynamically renders the comic image in the DOM
  4. Includes error handling for failed API requests
  5. Simple HTML, CSS, and JavaScript setup
  • Fully functional and ready for review.

Questions

  1. Is my approach to fetching and rendering the XKCD comic efficient, and are there ways to improve performance or code structure?
  2. How can I handle API errors or edge cases more effectively, e.g., if the API is down or returns invalid data?
  3. Are there best practices for dynamically updating the DOM when adding or replacing images in projects like this?

HoussamLh and others added 4 commits August 20, 2025 18:47
- implement getLatestComic function to fetch latest comic from API
- display comic image in DOM and log JSON data
add error handling for failed API requests
- implement getLatestComic function to fetch latest comic from API
- display comic image in DOM and log JSON data
- add error handling for failed API requests
@HoussamLh HoussamLh added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 20, 2025
@A-O-Emmanuel A-O-Emmanuel added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 21, 2025
Copy link

@A-O-Emmanuel A-O-Emmanuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your approach works and meets up with the task requirements, however, for real world scenarios, consider adding a loading indicator before displaying the data, that is, before displaying the image in this case.

@A-O-Emmanuel A-O-Emmanuel added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and all review comments have been addressed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants