function showWeatherIcon() {
    var weatherConditions, regExp, pattern, result, weatherIcon, icon;
    weatherConditions = document.querySelector('.weather__conditions').textContent;
    weatherIcon = document.getElementById('weather-icon');

    //Function created to verify whether given DOM.textContent has the words of specific pattern
    var checkPattern = function (pattern) {
        return weatherConditions.includes(pattern);
    }

    if (checkPattern('rain') || checkPattern('drizzle')) {
        icon = 'img/rain.svg';
    } else if (checkPattern('cloud') || checkPattern('overcast') || checkPattern('mist') || checkPattern('haze')) {
        icon = 'img/clouds.svg';
    } else if (checkPattern('clear') || checkPattern('sun')) {
        icon = 'img/sunny.svg';
    } else if (checkPattern('snow')) {
        icon = 'img/snowflake.svg';
    } else if (checkPattern('storm')) {
        icon = 'img/lightning.svg';
    }
    weatherIcon.src = icon;
}
//Function which switches icons according to weather in chosen city
Function which switches icons according to weather in chosen city
Function which switches icons according to weather in chosen city
function showWeatherIcon() {
    var weatherConditions, regExp, pattern, result, weatherIcon, icon;
    weatherConditions = document.querySelector('.weather__conditions').textContent;
    weatherIcon = document.getElementById('weather-icon');
    var checkPattern = function (pattern) {
        return weatherConditions.includes(pattern);
    }
    if (checkPattern('rain') || checkPattern('drizzle')) {
        icon = 'img/rain.svg';
    } else if (checkPattern('cloud') || checkPattern('overcast') || checkPattern('mist') || checkPattern('haze')) {
        icon = 'img/clouds.svg';
    } else if (checkPattern('clear') || checkPattern('sun')) {
        icon = 'img/sunny.svg';
    } else if (checkPattern('snow')) {
        icon = 'img/snowflake.svg';
    } else if (checkPattern('storm')) {
        icon = 'img/lightning.svg';
    }
    weatherIcon.src = icon;
}
function showWeatherIcon ( ) { var weatherConditions , regExp , pattern , result , weatherIcon , icon ; weatherConditions = document . querySelector ( '.weather__conditions' ) . textContent ; weatherIcon = document . getElementById ( 'weather-icon' ) ; var checkPattern = function ( pattern ) { return weatherConditions . includes ( pattern ) ; } if ( checkPattern ( 'rain' ) || checkPattern ( 'drizzle' ) ) { icon = 'img/rain.svg' ; } else if ( checkPattern ( 'cloud' ) || checkPattern ( 'overcast' ) || checkPattern ( 'mist' ) || checkPattern ( 'haze' ) ) { icon = 'img/clouds.svg' ; } else if ( checkPattern ( 'clear' ) || checkPattern ( 'sun' ) ) { icon = 'img/sunny.svg' ; } else if ( checkPattern ( 'snow' ) ) { icon = 'img/snowflake.svg' ; } else if ( checkPattern ( 'storm' ) ) { icon = 'img/lightning.svg' ; } weatherIcon . src = icon ; }
Function which switches icons according to weather in chosen city
Function which switches icons according to weather in chosen city
//Function created to verify whether given DOM.textContent has the words of specific pattern