Skip to content

Cape Town | 2026-ITP-Jan | Pretty Taruvinga | Sprint 3 | Quote generator#1199

Open
Pretty548 wants to merge 4 commits intoCodeYourFuture:mainfrom
Pretty548:quote-generator
Open

Cape Town | 2026-ITP-Jan | Pretty Taruvinga | Sprint 3 | Quote generator#1199
Pretty548 wants to merge 4 commits intoCodeYourFuture:mainfrom
Pretty548:quote-generator

Conversation

@Pretty548
Copy link
Copy Markdown

@Pretty548 Pretty548 commented Apr 14, 2026

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

Fixed ReferenceError: Cannot access 'quotes' before initialization
Moved displayQuote() call to run after the quotes array is defined
Ensured quotes and author display correctly on page load
Confirmed random quote functionality works on button click

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

@Pretty548 Pretty548 force-pushed the quote-generator branch 5 times, most recently from 79e6a16 to 9fd61b2 Compare April 16, 2026 09:59
@Pretty548 Pretty548 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 16, 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.

  • This branch is not clean. It contains a modified file which belongs to the Sprint-1 exercise. Can you revert the change to that file?

Note: On your main branch, you modified Sprint-1/fix/median.js. If you plan to create new branches on this repo, you should revert the change you made on main to prevent the new branches from being polluted.

];

// call pickFromArray with the quotes array to check you get a random quote
displayQuote();
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.

We should respect instructions like DO NOT EDIT BELOW HERE; it is usually there for a reason. If you are curious about why, you can ask AI Why should programmers respect "DO NOT EDIT BELOW HERE" instruction in a file?

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.

Thanks for pointing that out! I’ve removed the change below the “DO NOT EDIT” section and kept my updates within the intended area.

authorP.innerText = randomQuote.author;
}

button.addEventListener("click", displayQuote);
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 (lines 11 and 506) inside a function 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
});

@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 Apr 17, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@cjyuan
Copy link
Copy Markdown
Contributor

cjyuan commented Apr 17, 2026

Changes to the code look good.

Please fix this branch to keep it clean.

One way to revert changes to a file is via the git restore command.

First, locate a commit before the file was modified. It could be the first commit you made, assuming the branch started in a clean state.

Next, record the first 7 characters of the commit SHA.

Suppose the file is path/to/file, and you want to restore the file to its state before the commit with SHA 1234567.
The command is:

git restore --source=1234567^ path/to/file

After the file is restored, make a commit and push the changes to GitHub.

@Pretty548 Pretty548 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
@Pretty548 Pretty548 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 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.

You managed to make the branch clean now, but in the process you revert also the changes made to quote.js.
Can you reapply the changes you made?

You can see all the changed files here:
https://github.com/CodeYourFuture/Module-Data-Groups/pull/1199/changes

Image

It's a good habit to review all the changes you made on the PR branch (to ensure they are the changes you intended to make).

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
@Pretty548 Pretty548 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 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.

Change should be easy. I will mark this PR as complete first.

];

// call pickFromArray with the quotes array to check you get a random quote
displayQuote();
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.

This version still have this function call beyond the // DO NOT EDIT BELOW HERE marker.

@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 Apr 17, 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