Skip to content

Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 3 | Programmer Humour - #544

Open
KhotKeys wants to merge 2 commits into
CodeYourFuture:mainfrom
KhotKeys:programmer-humour
Open

Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 3 | Programmer Humour#544
KhotKeys wants to merge 2 commits into
CodeYourFuture:mainfrom
KhotKeys:programmer-humour

Conversation

@KhotKeys

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Learnt about fetch and the DOM, specifically:

  • used fetch to make an API call to the xkcd endpoint and rendered the comic image into the DOM.

@KhotKeys KhotKeys added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected labels Aug 12, 2026
@hey-hammad hey-hammad 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, 2026

@hey-hammad hey-hammad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good implementation overall. I have a few suggestions around DOM element checks, avoiding repeated DOM queries. Thanks

Comment thread fetch/programmer-humour/script.js Outdated
})
.then(function (data) {
console.log(data);
document.getElementById("comic-img").src = data.img;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

would it be better to if we cache the comic-img element instead of querying the DOM twice? It would make the code a bit cleaner and avoid repeating the selector.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also can we assume that elements comic-img and error are always available, and the absence will not break the code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

would it be better to if we cache the comic-img element instead of querying the DOM twice? It would make the code a bit cleaner and avoid repeating the selector.

All changes are fully fixed, thanks for the feedback

@hey-hammad hey-hammad added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 21, 2026
@KhotKeys KhotKeys added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants