Skip to content

London | 26-ITP-May | Zadri Abdule | Sprint 3 | Quote-generator - #1328

Open
Zadri415 wants to merge 2 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-3/quote-generator
Open

London | 26-ITP-May | Zadri Abdule | Sprint 3 | Quote-generator#1328
Zadri415 wants to merge 2 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-3/quote-generator

Conversation

@Zadri415

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

Completed the sprint-3 quote generator task.

@Zadri415 Zadri415 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 Jul 28, 2026

@cjyuan cjyuan left a comment

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.

Code looks good. Well done.

Comment on lines +28 to +29
quoteEl.textContent = `"${chosen.quote}"`;
authorEl.textContent = `— ${chosen.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 " and the leading appear to be for styling purposes. Keeping them in the HTML or in CSS could make it easier to style or modify the view. This allows front-end developers to adjust the UI without changing any JavaScript code.

Comment on lines +13 to +30
function showRandomQuote() {
let index;

if (quotes.length === 1) {
index = 0;
} else {
do {
index = Math.floor(Math.random() * quotes.length);
} while (index === lastIndex);
}

lastIndex = index;

const chosen = quotes[index];

quoteEl.textContent = `"${chosen.quote}"`;
authorEl.textContent = `— ${chosen.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.

Could probably separate the logic of selecting a random index (lines 14 to 24) from the presentation logic (lines 26-29).

@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 Aug 1, 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