I recently finished coding the local weather app. It took me a little while to figure out how API works, but I’m glad to see it functioning fine I know the code probably needs a little clean-up, but I am very new to coding so I would love to get feedback/help from the community!
Attached is the link to my project: http://codepen.io/judysmilingeyes/pen/ZBPXzO
Well you will be happy to know that your weather app - crafted by you - got the correct location and weather for my neck of the woods, and chances are I am in a completely different part of the world to you.
So function test = perfect.
Interestingly, you have mentioned the code in your post. I did exactly the same in my post for this project.
To be honest, your code looks much better than mine. I am still just throwing mine together as I go along when I realise I need to add this or add that. So much of my code often doesn’t work in first run so I am always making a lot of changes.
One of the things that is still tripping me up is getting variable values in and out of functions. I am always shifting code around to see where it has to sit so that the variables are picked up by the function or vice versa.
Thankfully CoidePen picks up the missing or excessive" });" etc. But I’d be in big trouble if this sort of tool wasn’t available.
The other thing that is again evident comparing yours to mine is the different ways we have approached the required user stories and how we coded them. Not altogether different, but through looking at other peoples’s work I have come to realise there are so many ways to code the same result. Previously with coding, I thought it was pretty much that to get form A to C you have to pass through B - it’s just computers right? Not so.
Did you any pre-planning before starting this project?
Glad to know the app passed the location/weather test where you are
However one thing that’s still bugging me is that though I have still yet to figure out how to get the complete list of weather conditions (a.k.a weather.main). I did switch/case to append the url of the background image to the background class, but I don’t think I’ve caught all the weather conditions possible out there.
I’m very new to coding, so I’m not sure what you meant exactly by “getting variable values in and out of functions”. Are you referring to global/local variables?
In terms of pre-planning, I did make an array of the weather conditions and their corresponding background images, but as I continued to code I realized that I was not sure how to access data from the said array so I just cut and pasted all the urls over. I’ve done a few sketches to walk myself through the logic of the process too, but sometimes what happens is that things get more complicated than I had expected