Weather APP feedback wanted

Hi,

I just finished my weather app.
Again i feel like i worked too long on it with all kinds of struggles (with the API, svg’s, rotating images …)
But i’m glad with the result, altough i should clean up my code and make more effort for responsiveness…(as i used a fixed width…)

Let me know what you think or what i could improve.
thanks

At first glance: your c to f formula is wrong

Now that i have looked over the code i could say the js code its kinda spaghetti code. Too many lines of code to achieve this result. In my opinion, you definitely should rework from scratch all you js code.

Try to cash you DOM. You are making a lot of calls to the DOM by using document.getElementById. Make it once like var location = document.getElementById("location"); and use that var whenever you need it.

I would also separate the concern into functions like: location(responsible for getting the user location), weather(responsible for getting the weather data from the api) and display(responsible for updating the dom with whatever i want to show to the user).

I think i fixed the c to f formula
I never tought about it that way, so you actually mean that to many dom calls would affect performance?

  • for location i have a separate function
  • I’ll try to rework my JS code.
  • I also had the issue that i had to wait for the location function to finish before proceeding and getting the weather info.
    As a workaround i’m calling the getWeather() function from within the getlocation function - is that OK or should i look for another solution?

thanks

I think you not. My location temp is 22C degrees that should be around 72F but the app reports 290℉