-
-
Notifications
You must be signed in to change notification settings - Fork 191
Glasgow | 25-ITP-Sep | Mohammed Abdoon | Sprint 3| Qoute Generator #851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Sprint-3/quote-generator/quotes.js
Outdated
| quoteText["textContent"] = `“${randomQuote.quote}”`; | ||
| authorText["textContent"] = `- ${randomQuote.author}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quoteText["textContent"] works but there is a cleaner and a more conventional way to set textContent. Can you update it to the more standard approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I just updated the code. I used the standard way. which is quoteText.textContent instead of quoteText["textContent"] .
Sprint-3/quote-generator/quotes.js
Outdated
| showRandomQuote(); | ||
| } | ||
|
|
||
| window.onload = setup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code is clean and well-organized, and wrapping everything inside a setup() function is a good way to avoid global variables. However, window.onload waits for images, fonts, and external files to finish loading, which makes it slower than necessary. Can you think of a different event or method that would allow your setup code to run as soon as the HTML is ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I used document.addEventListener("DOMContentLoaded", setup); insteadinstead so the setup runs as soon as the HTML is ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. Well-done!
|
The changes have been made. Thank you. |
Learners, PR Template
Self checklist
Changelist
Quote generator app exercise done.
Questions
No questions so far, thank you.