Open
Conversation
CheezItMan
reviewed
Dec 13, 2021
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Diana, you hit the learning goals here. Well done. I like the styling, very solid submission.
Other than my comments the only suggestion for improvement I have is to consider adjusting the layout to fit mobile devices. (not important, just a note for later).
| const resetButton = document.getElementById('reset'); | ||
| resetButton.addEventListener('click', resetCity) | ||
| }; | ||
| document.addEventListener("DOMContentLoaded", registerEventhandlers); |
Comment on lines
+49
to
+67
| const upTemperature = () => { | ||
| const tempUp = document.getElementById('base-temp'); | ||
| //Makes temp count go up | ||
| state.temperature += 1; | ||
| //Making the text content o tempUp = the current temperature | ||
| tempUp.textContent = `${state.temperature}`; | ||
| //querySelector: Returns the first element | ||
| const tempUptemp = document.querySelector('#temperature') | ||
| const clothes = document.getElementById('clothes') | ||
| temperature() | ||
| }; | ||
| const downTemperature = () => { | ||
| const tempDown = document.getElementById('base-temp'); | ||
| state.temperature -= 1; | ||
| //Returns every element in the Node | ||
| tempDown.textContent = `${state.temperature}`; | ||
| //This line is selecting the temperature id | ||
| temperature() | ||
| }; |
There was a problem hiding this comment.
Just note that these two functions could be combined into one that takes a parameter.
Then the event handler could look like.
TemperatureHot.addEventListener('click', () => upTemperature(+1))
and
TemperatureHot.addEventListener('click', () => upTemperature(-1))
You would just need to modify the function to use the parameter instead of a hardcoded state.temperature += 1 or state.temperature -= 1
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.
No description provided.