assets/script.js
// displayWeather - display current weather in top card
display current weather in top card
display current weather in top card
function displayWeather(response) {
    $("#currentCity").empty();
    $("#temperature").empty();
    $("#humidity").empty();
    $("#windSpeed").empty();
    $("#UVIndex").empty();
    $("#UVIndex").removeClass();
    var currentDate = currentTime.format('L');
    var tempInfo = response.current;
    var icon = tempInfo.weather[0].icon;
    var iconURL = `http://openweathermap.org/img/w/${icon}.png`;
    var iconEl = $("<img>");
    iconEl.attr("src", iconURL);
    var uvClass = getUVClass(tempInfo.uvi);
    $("#currentCity").append(`${currentCity} (${currentDate})`);
    $("#currentCity").append(iconEl);
    $("#temperature").append(`Temperature: ${tempInfo.temp}&deg;F`);
    $("#humidity").append(`Humidity: ${tempInfo.humidity}&#37;`);
    $("#windSpeed").append(`Wind Speed: ${tempInfo.wind_speed} MPH`);
    $("#UVIndex").append(`UV Index: ${tempInfo.uvi}`);
    $("#UVIndex").addClass(uvClass);
}
function displayWeather ( response ) { $ ( "#currentCity" ) . empty ( ) ; $ ( "#temperature" ) . empty ( ) ; $ ( "#humidity" ) . empty ( ) ; $ ( "#windSpeed" ) . empty ( ) ; $ ( "#UVIndex" ) . empty ( ) ; $ ( "#UVIndex" ) . removeClass ( ) ; var currentDate = currentTime . format ( 'L' ) ; var tempInfo = response . current ; var icon = tempInfo . weather [ 0 ] . icon ; var iconURL = ` ${ icon } ` ; var iconEl = $ ( "<img>" ) ; iconEl . attr ( "src" , iconURL ) ; var uvClass = getUVClass ( tempInfo . uvi ) ; $ ( "#currentCity" ) . append ( ` ${ currentCity } ${ currentDate } ` ) ; $ ( "#currentCity" ) . append ( iconEl ) ; $ ( "#temperature" ) . append ( ` ${ tempInfo . temp } ` ) ; $ ( "#humidity" ) . append ( ` ${ tempInfo . humidity } ` ) ; $ ( "#windSpeed" ) . append ( ` ${ tempInfo . wind_speed } ` ) ; $ ( "#UVIndex" ) . append ( ` ${ tempInfo . uvi } ` ) ; $ ( "#UVIndex" ) . addClass ( uvClass ) ; }
displayWeather - display current weather in top card
displayWeather - display current weather in top card
// clear display elements // get image to display // get class info for uv to show color based on uv level // append the current weather info to html elements by ID