Skip to content

Sheffield | 26-Jan-ITP | Daniel Aderibigbe | Sprint 3 | Quote generator#1060

Open
Dan2Clouted wants to merge 5 commits intoCodeYourFuture:mainfrom
Dan2Clouted:quote-generator
Open

Sheffield | 26-Jan-ITP | Daniel Aderibigbe | Sprint 3 | Quote generator#1060
Dan2Clouted wants to merge 5 commits intoCodeYourFuture:mainfrom
Dan2Clouted:quote-generator

Conversation

@Dan2Clouted
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

The quote generator app exercise completed.

@Dan2Clouted Dan2Clouted added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 21, 2026
const randomQuote = pickFromArray(quotes);

quoteElement.textContent = randomQuote.quote;
authorElement.textContent = `- ${randomQuote.author}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The leading - appears to be for styling purposes. Keeping it in the CSS or in HTML could allow us to adjust the view without changing any JavaScript code.

Comment on lines +14 to +16
displayRandomQuote();

buttonElement.addEventListener("click", displayRandomQuote);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Placing all the "run on load" code in one place can make it clearer that
"this is what runs when the page loads."

For examples,

function setup() {
  // code to be executed on page load
}

window.addEventListener('load', setup);

or

window.addEventListener('load', function() {
  // code to be executed on page load
});

if (autoPlayElement.checked) {
statusElement.textContent = "auto-play: ON";

clearInterval(intervalId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible that the interval is active when the checkbox's state changes to "checked"?

@cjyuan cjyuan 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 Mar 27, 2026
@Dan2Clouted
Copy link
Copy Markdown
Author

Thanks for the feedback! I’ve updated the code by:

  • Moving the "-" to CSS instead of JavaScript
  • Grouping the run-on-load logic into a setup function
  • Reviewing the interval logic to ensure no duplicate intervals

@Dan2Clouted Dan2Clouted added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 27, 2026
@cjyuan
Copy link
Copy Markdown
Contributor

cjyuan commented Mar 27, 2026

Changes look good. Well done.

@cjyuan cjyuan 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 Mar 27, 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