Skip to content

London | No Cohort | Daniel Wagner-Hall | Sprint 3 | Quote Generator - #1475

Closed
illicitestonion wants to merge 1 commit into
CodeYourFuture:mainfrom
illicitestonion:dwh-quote-generator
Closed

illicitestonion wants to merge 1 commit into
CodeYourFuture:mainfrom
illicitestonion:dwh-quote-generator

Conversation

@illicitestonion

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

Task code

CYF-1096

Changelist

Implements quote generator app.

@illicitestonion illicitestonion added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 8, 2026
Comment on lines +2 to +4
const {quote, author} = pickFromArray(quotes);
document.getElementById("quote").innerText = quote;
document.getElementById("author").innerText = author;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I notice that the logic for choosing a random quote and updating the quote and author elements appears twice: once in the DOMContentLoaded handler and once in the button click handler. If you ever need to change how a quote is picked or how it is displayed (for example, changing the DOM element IDs or adding extra formatting), you would need to remember to update both places and keep them in sync.

How would it feel to extract those three lines into a small function, and then call that function from both event listeners? That way the behavior for “show a new quote” would live in exactly one place, and both the initial load and the button click would just reuse it. This can make the code easier to maintain and test as the project grows.

To "like" or "dislike" this comment, please follow this link

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot 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 Oct 8, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants