London | 26-ITP-Jan | Miriam Jorna | Sprint 3 | Quote generator#1202
London | 26-ITP-Jan | Miriam Jorna | Sprint 3 | Quote generator#1202miriamjorna wants to merge 2 commits intoCodeYourFuture:mainfrom
Conversation
| function displayQuote() { | ||
| const randomQuote = pickFromArray(quotes); | ||
| quoteP.textContent = randomQuote.quote; | ||
| authorP.textContent = `- ${randomQuote.author}`; |
There was a problem hiding this comment.
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.
| ]; | ||
|
|
||
| // call pickFromArray with the quotes array to check you get a random quote | ||
| pickFromArray(quotes); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Thank you. I had read the
// call pickFromArray with the quotes array
as the end of the
DO NOT EDIT
section with a new instruction.
| window.onload = function() { | ||
| displayQuote(); | ||
| }; | ||
|
|
||
| newQuoteButton.addEventListener("click", displayQuote); |
There was a problem hiding this comment.
Line 15 is also a run-on-load operation. You can consider keeping it in the "onload" callback function.
There was a problem hiding this comment.
Ah, of course. That makes more sense. Thank you!
Self checklist
Changelist
Made a quote generator as per instructions