I just finished my first draft of my Weather Application and was wanting to receive feedback on how I did and whether my code is readable and appropriate.
Let me know!
Thank you!
Here is the link to the pen:
I just finished my first draft of my Weather Application and was wanting to receive feedback on how I did and whether my code is readable and appropriate.
Let me know!
Thank you!
Here is the link to the pen:
Its ok. The only thing i think you should change is setInterval(setWeatherData, 1000 * 30)
that force the app to refresh every 30 secs. The weather api return forecast hourly. If your intention was just to adjust only the time then you should make a function to update only the time.
I would also show the user location that is missing.
It’s good. But I think you can break your setWeatherData() into more manageable pieces.
Since you are using AJAX you can refactor the code to have a standalone AJAX GET request to handle the Requests with a callback .
Also, I see “document.getElementById(‘temperature’)” been repeated. You can set this into a variable var temperature = document.getElementById('temperature')
and then call it.
Hope this works.
Nice work i think making the functions in setWeatherData
standalone functions will make the code more readable. Cheers!!