-
-
Notifications
You must be signed in to change notification settings - Fork 155
Glasgow | ITP May 2025 | Adiyah Farhan | Sprint 3 | Quote Generator App #742
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?
Glasgow | ITP May 2025 | Adiyah Farhan | Sprint 3 | Quote Generator App #742
Conversation
… quotes on the page load and "New-quote" button click
@@ -3,13 +3,16 @@ | |||
<head> | |||
<meta charset="UTF-8" /> | |||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |||
<title>Title here</title> | |||
<script defer src="quotes.js"></script> |
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.
Can you explain why the originally script tag was up on the head tag (not in the bottom of body) and what defer
attribute does here?
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.
If we use <script> tag up on the tag, without the defer attribute then it downloads and executes the script before parsing the complete file. As a result, the script that tries to access the elements in the that haven't been parsed yet, t will return null because the element doesn’t exist in the DOM yet.
But if we use a defer attribute, it will just download the script on the head but executes the script after the is fully parsed. So by adding defer attribute, we can avoid any blocking issues that makes script to behave improperly.
Good job! It works as intended and code is well structured. I left a comment. Please have a look! |
…sn't make any affect in functionality of the app
Learners, PR Template
Self checklist
Changelist
Implement the "Quote Generator App" so that It can display one random quote from the array of quotes on page loads and when the user clicks "New Quote" button, a new random quote will be generated.
Questions
No