Ciao a tutti! Sto frequentando un corso di Javascript, e mi è stato chiesto di creare una card con i dati meteo di open-meteo.
Ho appena finito la funzione che dovrebbe sostituire il weathercode con un'icona del meteo in base al tempo, e non sono sicuro che funzioni.
Pareri? Grazie in anticipo!

let
jsonData = {};

fetch('https://api.open-meteo.com/v1/forecast?latitude=45.07&longitude=7.69&current_wea ther=true&hourly=weathercode&timezone=CET&daily=we athercode')
.then(response => response.json())
.then(json => {

tempoCorrente = json.current_weather;
giorno = json.daily;

mostraTempo(tempoCorrente);
mostraGiorno(giorno);
//console.log(giorno);
//console.log(tempoCorrente);

})




function mostraTempo(tempoCorrente) {
let contenitore = document.getElementById("contenitore");
contenitore.innerHTML = "";

let i = document.createElement("i");
i.className = "tempo";

switch (tempoCorrente.weathercode) {
case 0:
i.className += "wi-day-sunny";
break;

case 1:
case 2:
case 3:
i.className += "wi-day-cloudy";
break;

case 45:
case 48:
i.className += "wi-day-fog";
break;

case 51:
case 53:
case 55:
i.className += "wi-raindrops";
break;

case 56:
case 57:
i.className += "wi-day-rain-mix";
break;

case 61:
case 63:
case 65:
i.className += "wi-day-rain";
break;

case 66:
case 67:
i.className += "wi-day-sleet";
break;

case 71:
case 73:
case 75:
i.className += "wi-day-snow";
break;

case 77:
i.className += "wi-stars";
break;

case 80:
case 81:
case 82:
i.className += "wi-day-showers";
break;

case 85:
case 86:
i.className += "wi-day-snow-wind";
break;

case 95:
i.className += "wi-day-snow-thunderstorm";
break;

case 96:
case 99:
i.className += "wi-day-thunderstorm";
break;

default:
i.className += " wi-day-sunny"; // Icona di default nel caso in cui il codice del tempo non corrisponda a nessun caso specificato
}

let tempoElement = document.getElementById("tempo");
tempoElement.innerHTML = "";
tempoElement.appendChild(i);
}