function uvIndex(coordinates) {
    let queryURL = `https://api.openweathermap.org/data/2.5/uvi?lat=${coordinates.lat}&lon=${coordinates.lon}&APPID=${apiKey}`;

    $.get(queryURL).then(function (response) {
        let currUVIndex = response.value;
        // default green color for the UV index
        let uvStrength = "green";
        let textColor = "white"

        // based on the returned UV index, the color of the value will be set.
        if (currUVIndex >= 8) {
            uvStrength = "red";
            textColor = "white"
        } else if (currUVIndex >= 6) {
            uvStrength = "orange";
            textColor = "black"
        } else if (currUVIndex >= 3) {
            uvStrength = "yellow";
            textColor = "black"
        }
        currWeatherDiv.append(`<p>UV Index: <span class="text-${textColor}" style="background-color: ${uvStrength};">${currUVIndex}</span></p>`);
    })
}
// API call to retrieve the UV index, this is called in the "reutnrCurrentWeather" function.
API call to retrieve the UV index, this is called in the "reutnrCurrentWeather" function.
API call to retrieve the UV index this is called in the " reutnrCurrentWeather " function .
function uvIndex(coordinates) {
    let queryURL = `https://api.openweathermap.org/data/2.5/uvi?lat=${coordinates.lat}&lon=${coordinates.lon}&APPID=${apiKey}`;
    $.get(queryURL).then(function (response) {
        let currUVIndex = response.value;
        let uvStrength = "green";
        let textColor = "white"
        if (currUVIndex >= 8) {
            uvStrength = "red";
            textColor = "white"
        } else if (currUVIndex >= 6) {
            uvStrength = "orange";
            textColor = "black"
        } else if (currUVIndex >= 3) {
            uvStrength = "yellow";
            textColor = "black"
        }
        currWeatherDiv.append(`<p>UV Index: <span class="text-${textColor}" style="background-color: ${uvStrength};">${currUVIndex}</span></p>`);
    })
}
function uvIndex ( coordinates ) { let queryURL = ` ${ coordinates . lat } ${ coordinates . lon } ${ apiKey } ` ; $ . get ( queryURL ) . then ( function ( response ) { let currUVIndex = response . value ; let uvStrength = "green" ; let textColor = "white" if ( currUVIndex >= 8 ) { uvStrength = "red" ; textColor = "white" } else if ( currUVIndex >= 6 ) { uvStrength = "orange" ; textColor = "black" } else if ( currUVIndex >= 3 ) { uvStrength = "yellow" ; textColor = "black" } currWeatherDiv . append ( ` ${ textColor } ${ uvStrength } ${ currUVIndex } ` ) ; } ) }
API call to retrieve the UV index, this is called in the "reutnrCurrentWeather" function.
API call to retrieve the UV index this is called in the " reutnrCurrentWeather " function .
// default green color for the UV index // based on the returned UV index, the color of the value will be set.