Glasgow | JAN-ITP-2026 | Alasdair MacDonald | Sprint 3 | Quote Generator app#1035
Glasgow | JAN-ITP-2026 | Alasdair MacDonald | Sprint 3 | Quote Generator app#1035MacDonald91 wants to merge 3 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
Code is working good.
Note: 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?
| displayRandomQuote(); | ||
|
|
||
| // button click | ||
| document | ||
| .getElementById("new-quote") | ||
| .addEventListener("click", displayRandomQuote); |
There was a problem hiding this comment.
Can you put all the "run on load" code inside a function?
Doing so 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
});There was a problem hiding this comment.
Thanks for the suggestion!
I’ve moved all the “run on load” logic into a setup function and attached it to the window load event to make the structure clearer and easier to understand.
Let me know if there’s anything else I can improve.
|
All good. Well done. |
Learners, PR Template
Self checklist
Changelist
Finished building a complete working quote generator app.
Questions
no questions.