Skip to content

Instantly share code, notes, and snippets.

@airportyh
Last active May 24, 2017 14:29
Show Gist options
  • Select an option

  • Save airportyh/ad6abdadd2a480095e17af8ba26f6214 to your computer and use it in GitHub Desktop.

Select an option

Save airportyh/ad6abdadd2a480095e17af8ba26f6214 to your computer and use it in GitHub Desktop.
JavaScript Errors

Post as many JavaScript errors as you can by breaking the provided code. Try to come up with explanation of the error you get. Prizes for the weirdest error.

@stephenward21

Copy link
Copy Markdown

Here's the error:
Uncaught SyntaxError: Unexpected identifier weather.js:10

var APPID = 'd572e3897b56c1638fada0388125c161';
$(document).ready(function() {
  $('#button').click(function() {
    $.ajax({
      method: 'GET',
      url: 'http://api.openweathermap.org/data/2.5/weather',
      data: {
        q: $('#q').val(),
        units: 'imperial'
        APPID: APPID
      },
      success: function(data) {
        $('#display').html(
          // '<h2>Forecast for ' + data.name + ':</h2>' +
          'Temperature: ' + data.main.temp + '°F<br>' +
          'Hi: ' + data.main.temp_max + '°F<br>' +
          'Lo: ' + data.main.temp_min + '°F<br>' +
          data.weather.description + '<br>' +
          '<img src="http://openweathermap.org/img/w/' + data.weather[0].icon + '.png">'
        );
      }
    })
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment