-
Notifications
You must be signed in to change notification settings - Fork 527
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
Sharks/Bahareh #17
base: main
Are you sure you want to change the base?
Sharks/Bahareh #17
Conversation
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.
Great job, Bahareh! While these days we don't run into issues with JavaScript files loading faster than the html content can. That can make adding event handlers to HTML elements tricky.
It's standard practice to group all our event handlers and "register" them using the COMContentLoaded
event at the end of the file. You may have seen function calls like this in the Learn platform:
const registerEventHandler = () => {
realTimeButton.addEventListener('click', saveCity);
// the rest of the event handlers here
};
document.addEventHandler('DOMContentLoaded', registerEventHandlers);
.then((response) => { | ||
console.log(response); | ||
return response.data.current.temp; | ||
}) | ||
.then((response)=>{ | ||
console.log(response); | ||
return Math.floor((response - 273.15) * 9/5 + 32) | ||
}) | ||
.then((response)=>{ | ||
console.log(response); | ||
state.temp=response | ||
tempContainer.textContent=`${state.temp}`; | ||
|
||
}) |
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.
Ooo nice job learning how to chain promises!
const saveCity=()=>{ | ||
const cityName= document.getElementById('input').value; | ||
state.city=cityName | ||
console.log(state.city); |
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.
don't forget to take out debugging print statements like this out for final submissions
console.log(state.city); |
No description provided.