Week 5 Homework

Continue the "Weathernator" application we started during lab; deliver a complete weather application using the WeatherAPI.com API as a source for weather data.

Getting Started

Use the code from lab as your starting point (a solution was provided in class, if you'd like to start there). Create a new repository in your own GitHub account called hw5, a HTML file called week5.html and a JS file called week5.js. Clone this repository to your computer and start from there.


  1. (1 point) Write the recipe (algorithm) for the approach you're taking in the comments. As previously discussed, it is highly recommended you do this first, then write the code.
  2. (2 points) Accept a number of days from the end-user, in addition to the free-text location done during lab. Use these two inputs (along with your WeatherAPI.com API key) to retrieve JSON data from WeatherAPI.com.
  3. (2 points) Display the current weather conditions for the given location – display the parsed location (city and state/region), current temperature, and current conditions (e.g. "partly cloudy").
  4. (4 points) Using a for-loop and what you know about manipulating the DOM, display a daily forecast. For the number of days provided by the end-user, display the weather forecast; e.g. if the end-user asks for 2 days, show a 2-day forecast. Each day of the forecast should show (at a minimum) the date, high and low temperature, and a summary of the conditions (e.g. "partly cloudy") for each day. Note: the free WeatherAPI.com plan only offers up to a 3 day forecast; so in testing, you can try 1, 2, or 3 days. However, your code should accommodate any number of days provided.
  5. (1 point) In the HTML file, delete the hard-coded HTML provided as examples. You should be left with two empty DIVs for current and forecast.

Guidelines for Submission

Your finished product should live in your GitHub account at https://github.com/<your GitHub username>/hw5, and this URL should be submitted as the "website URL" for this assignment in Canvas.