Feedback for Weather App: How do I clean up JS Code?

See the Pen Local Weather Pen by (@medjosh) on CodePen.


Why do you have like 6 ‘$.getJSON’ in the code? You only need one.

Okay, I see that you use Google API as well… I am not sure why?

Why do you nest $.getJSON inside another one? Are you having a hard time accessing the JSON objects? I suggest you practice accessing the JSON objects because that is an extremely important skill.

Usually, when people convert between two units, they just do the math, not call API.

Hope this helps.

For the location (City, State).

I did have a hard time with JSON, APIs, Ajax and jQuery. I left the project a month ago and I just got back after learning more about jQuery through Udemy.

It seemed necessary at the time; I never edited it.

Didn’t know that! It’s good I asked then.

Thanks for the help! I just updated the pen.


Well done! I see a massive improvement and major cleanup ops here! Congrats!