Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | Quote Generator#1151
Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | Quote Generator#1151mshayriyesaricicek wants to merge 3 commits intoCodeYourFuture:mainfrom
Conversation
jayshreehajgude2012
left a comment
There was a problem hiding this comment.
Nice styling but use externally.
Java script file linked correctly.
DOM methods used correctly.
Resolve Error-quotes array missing.
Sprint-3/quote-generator/index.html
Outdated
| padding: 10px 20px; | ||
| font-size: 16px; | ||
| } | ||
| </style> |
There was a problem hiding this comment.
You can use external CSS file and link it to CSS to make code clean.
There was a problem hiding this comment.
I didn't see the css file that is why I did in html. I have put all styling in css now and linked in the html. Thank you.
| font-size: 16px; | ||
| } | ||
| </style> | ||
| <script defer src="quotes.js"></script> |
There was a problem hiding this comment.
Correctly linked JavaScript file.
| @@ -1,3 +1,20 @@ | |||
| // DO NOT EDIT ABOVE HERE | |||
| window.addEventListener("DOMContentLoaded", () => { | |||
There was a problem hiding this comment.
You used DOMContentLoaded properly
Clean DOM selection
Good use of textContent
Proper event listener used.
You can explore more DOM selection and Event handling methods.
| const newQuoteBtn = document.getElementById("new-quote"); | ||
|
|
||
| function displayRandomQuote() { | ||
| const randomQuote = pickFromArray(quotes); |
There was a problem hiding this comment.
Quote Array is missing look into it.
There was a problem hiding this comment.
I am not sure if you are referring to the qoute array being defined after the function that uses it? I understood that we had to write our code above the line that says do not edit below so that is what I did. Or is there something else that I am missing? Thank you
There was a problem hiding this comment.
@mshayriyesaricicek does it currently work as you have it here? the quotes variable is only defined later on line 41 so the function is not able to work with quotes. The comment // DO NOT EDIT BELOW HERE is a bit misleading sorry
There was a problem hiding this comment.
Hi Kyle, thank you for getting back to me. The programme is running fine and it is not a problem with the quotes variable being defined later on line 41 as I have <script defer src="quotes.js"></script> on line 8 in html. Do you want me to move my code in quotes.js to the bottom of the file so it is below quotes array? Thank you
|
Hi Jay Please can you review my pull request as I need it to be complete to pass Step 3. This is the only thing outstanding. I have looked carefully at my programme and the Quotes Array is at the bottom of quotes.js I am not sure if you are wanting me to explain that the pickFromArray(quotes) function is called before quotes is defined and that this is not an issue because in html I have 'defer' so everything will be loaded before the function is performed therefore the prorgramme runs correctly. |
Self checklist
Changelist
Added a function to enable random quotes to be generated by pressing the new quote buttons.
Added style to the page by updated HTML.