Skip to content

London | 26-ITP-May | Tomislav Dukez | Sprint 3 | Programmer Humour - #537

Open
tomdu3 wants to merge 7 commits into
CodeYourFuture:mainfrom
tomdu3:sprint-3/programmer-humour
Open

London | 26-ITP-May | Tomislav Dukez | Sprint 3 | Programmer Humour #537
tomdu3 wants to merge 7 commits into
CodeYourFuture:mainfrom
tomdu3:sprint-3/programmer-humour

Conversation

@tomdu3

@tomdu3 tomdu3 commented Aug 12, 2026

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

Added Programmer Humour Task files

  • index.html, style.css, and scripts.js
  • I have also added a fallback image (default): assets/no_image.webp, while image is being fetched, or if API call fails

@tomdu3 tomdu3 added 🏕 Priority Mandatory This work is expected Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Flows The name of the module. labels Aug 12, 2026
@tomdu3 tomdu3 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 12, 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.

Nice work overall. I noticed a few code quality issues that would be good to clean up. Thanks

Comment thread fetch/programmer-humour/script.js Outdated
@@ -0,0 +1,26 @@
const imgEl = document.getElementsByTagName("img")[0];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is there a better way of getting the specific image element without using the tag?

Think about the following:

Right now we're assuming there is always 1 image element in the html, what if that changes to 0?

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.

I solved the problem with js element creation and fallbackImg integration which solves both problems

Comment thread fetch/programmer-humour/script.js Outdated
}
};

let data;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is the outer let data; still needed here?

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.

removed data variable initialisation

Comment thread fetch/programmer-humour/script.js Outdated
};

let data;
fetchData().then((data) => {

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 make sense to keep the async flow consistent by using async/await when consuming fetchData() as well, rather than mixing async/await and .then()?

Also, should we add a guard for the image element before setting imgEl.src?

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.

fixed fetch logic and guard for image

@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 21, 2026
@tomdu3 tomdu3 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 22, 2026
@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 25, 2026
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. Module-Data-Flows The name of the module. 🏕 Priority Mandatory This work is expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants