Skip to content

London | 26-ITP-May | Raihan Sharif | Sprint 3 | Quote Generator#1221

Open
RaihanSharif wants to merge 3 commits intoCodeYourFuture:mainfrom
RaihanSharif:sprint3-quote-generator
Open

London | 26-ITP-May | Raihan Sharif | Sprint 3 | Quote Generator#1221
RaihanSharif wants to merge 3 commits intoCodeYourFuture:mainfrom
RaihanSharif:sprint3-quote-generator

Conversation

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

On page load display random quote. On button click display random quote.

@RaihanSharif RaihanSharif added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels May 8, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

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."

Consider organizing the code in the following manner:

// Function definitions 
function showQuote() {
  ...
}
...

window.addEventListener('load', function() {
  // code to be executed on page load, including code that setup event listeners
});

Comment thread Sprint-3/quote-generator/quotes.js Outdated
newQuoteBtn.addEventListener("click", () => {
const selectedQuote = pickFromArray(quotes);
quoteText.textContent = selectedQuote.quote;
authorText.textContent = `-- ${selectedQuote.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 thread Sprint-3/quote-generator/quotes.js Outdated
authorText.textContent = `-- ${selectedQuote.author}`;
});

document.onload = newQuoteBtn.click();
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.

Why assign the return value of .click() to document.onload?

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.

meant to do window.onload = () => newQuoteBtn.click();

Now uses function to generate quote and calls that instead.

@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 May 10, 2026
…ener to call that function instead of triggering click event.
@RaihanSharif RaihanSharif 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 May 10, 2026
@cjyuan
Copy link
Copy Markdown
Contributor

cjyuan commented May 10, 2026

Changes look good.

@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. labels May 10, 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-Groups The name of the module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants