title: Cannot read property '0' of undefined
body: <p>I get "Cannot read property '0' of undefined" error. I couldn't find the issue. I think javascript file has a problem but I couldn't see. I wrote the script twice but still js file has a problem. </p>
  
  <p>HTML File</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;FreeCodeCamp - Local Weather&lt;/title&gt;
      &lt;script src="https://code.jquery.com/jquery-3.0.0.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="app.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css"/&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="main" class="text-center container"&gt;
      &lt;h1&gt;FreeCodeCamp - Weather App&lt;/h1&gt;
      &lt;div class="row" id="fade"&gt;
          &lt;div style="margin-top: 200px;"&gt;
              &lt;span id="city"&gt;&lt;/span&gt;
              &lt;span id="country"&gt;&lt;/span&gt;
              &lt;div id="weather"&gt;&lt;img id="w-icon"&gt;&lt;span id="temp"&gt;&lt;/span&gt;&lt;/div&gt;
              &lt;span id="description"&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="author"&gt;
          &lt;span&gt; Created by Kaan Karaca&lt;/span&gt;&lt;br&gt;
          &lt;span&gt;&lt;a href="http://github.com/h4yfans"&gt;@GitHub&lt;/a&gt; &lt;/span&gt;&lt;br&gt;
          &lt;span&gt;&lt;a href="https://www.freecodecamp.com/h4yfans"&gt;@FreeCodeCamp&lt;/a&gt; &lt;/span&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JavaScript File</p>
  
  <pre><code>$(document).ready(function () {
  var cityId;
  var city;
  var unitsFormat = "metric";
  
  var getWeatherInfo = function () {
      $.getJSON("http://api.sypexgeo.net/json")
          .done(function (locationData) {
              cityId = locationData.city.id;
              cityName = locationData.country.iso;
  
              $.getJSON("http://api.openweathermap.org/data/2.5/weather?", {
                  id: cityId,
                  units: unitsFormat,
                  APPID: '610ae7b6406da76bb34ad4bb95cc3673'
              })
                  .done(function (weatherDate) {
                      $("#w-icon").attr("src", "http://openweathermap.org/img/w/" + weatherDate.weather[0].icon + ".png");
                      $("#temp").text(Math.round(weatherDate.main.temp) + "°C");
                      $("#city").text(weatherDate.name + ",");
                      $("#country").text(cityName);
                      $("#description").text(weatherDate.weather[0].description);
  
                  });
          });
  }
  
  getWeatherInfo();
  
  });
  </code></pre>