London|26-ITP-January|Alexandru Pocovnicu|Sprint 3| quote generator app#984
Open
alexandru-pocovnicu wants to merge 10 commits intoCodeYourFuture:mainfrom
Open
London|26-ITP-January|Alexandru Pocovnicu|Sprint 3| quote generator app#984alexandru-pocovnicu wants to merge 10 commits intoCodeYourFuture:mainfrom
alexandru-pocovnicu wants to merge 10 commits intoCodeYourFuture:mainfrom
Conversation
…ent listeners for better readability
takanocap
suggested changes
Mar 18, 2026
Sprint-3/quote-generator/quotes.js
Outdated
| // call pickFromArray with the quotes array to check you get a random quote | ||
|
|
||
| function chooseQuote() { | ||
| const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; |
There was a problem hiding this comment.
welldone you have done a good job just a few things:
can we make the line easy to understand research KISS and SOC and DRY. can we do something to avoid repeating the line 496? its used in line 20 too
Sprint-3/quote-generator/quotes.js
Outdated
| let interval = null; | ||
| autoGenerate.addEventListener("change", () => { | ||
| if (autoGenerate.checked) { | ||
| interval = setInterval(chooseQuote, 2000); |
There was a problem hiding this comment.
what doeas 2000 mean? what are magic numbers ? and how can we handle magic numbers ?
Sprint-3/quote-generator/quotes.js
Outdated
| const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; | ||
|
|
||
| const quote = document.getElementById("quote"); | ||
| quote.innerText = randomQuote.quote; |
There was a problem hiding this comment.
can we use textContent instead of innerText and why ?
what happens if quote is null ?
Author
|
thank you |
| const randomQuote = pickFromArray(quotes) | ||
|
|
||
| const quote = document.getElementById("quote"); | ||
| if(quote!==null){ |
There was a problem hiding this comment.
please check spacing here and elsewhere, use the style guide as reference
| interval = setInterval(chooseQuote, changeQuoteInterval); | ||
| } else { | ||
| clearInterval(interval); | ||
| interval = null; |
There was a problem hiding this comment.
this line may not be necessary, try removing it and see if it works?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
wrote code to show random quote and author