Skip to content

Birmingham | 26-ITP-May | Toluwalase Tiamiyu | Sprint 3 | Quote Generator App - #1320

Open
TTiamiyu wants to merge 3 commits into
CodeYourFuture:mainfrom
TTiamiyu:sprint3-quote-generator-app
Open

Birmingham | 26-ITP-May | Toluwalase Tiamiyu | Sprint 3 | Quote Generator App#1320
TTiamiyu wants to merge 3 commits into
CodeYourFuture:mainfrom
TTiamiyu:sprint3-quote-generator-app

Conversation

@TTiamiyu

@TTiamiyu TTiamiyu commented Jul 28, 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

@github-actions

This comment has been minimized.

4 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@TTiamiyu TTiamiyu changed the title Birmingham | 26-ITP-May | Toluwalase Tiamiyu | Sprint3 | Quote Generator App Birmingham | 26-ITP-May | Toluwalase Tiamiyu | Sprint 3 | Quote Generator App Jul 28, 2026
@github-actions

This comment has been minimized.

@TTiamiyu
TTiamiyu force-pushed the sprint3-quote-generator-app branch from a317f41 to 4967200 Compare July 28, 2026 01:51
@TTiamiyu TTiamiyu added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 28, 2026

@LonMcGregor LonMcGregor 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 work, I have a couple of questions

Comment thread Sprint-3/quote-generator/quotes.js Outdated

// Function to select a random quote and update the HTML elements
function displayNewQuote() {
const quoteP = document.querySelector("#quote");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you need to use querySelector here? Is there a more efficient method you could use?

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 found that .getElementById() works better and its also easier to read. thank you.


// 2. Add a click event listener to the "New quote" button
const newQuoteBtn = document.querySelector("#new-quote");
if (newQuoteBtn) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do you use an if check 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.

i used it to serve as a form of guardrail instruction - Only attach the event listener if the button actually exists on the page. If it doesn't, skip it and keep running the rest of the app safely.

checking online there are other ways i can achieve the same effect, do you think i should use another method?

@LonMcGregor LonMcGregor added 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. labels Aug 1, 2026
@TTiamiyu TTiamiyu added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 2, 2026
@LonMcGregor

LonMcGregor commented Aug 3, 2026

Copy link
Copy Markdown

On the if guard, this works, I wanted to make sure you understood how this worked, no need to change it.

Good work on this task, it is complete now.

@LonMcGregor LonMcGregor added 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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 3, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants