Five day forecast for loop not returning data

I’ve been working on a project that requires me to get a five day forecast, but when I try to get the for loop to return the five day value, it’s only returning the information for the last day five times. This is the code I have:

function displayWeatherFiveDay(weather) {
    for (var i = 0; i < weather.length; i++) {
        var fiveDayTemp = weather[i];
        var fiveDayHumid = weather[i].humidity;

        console.log(fiveDayTemp, fiveDayHumid);

        for (var q = 0; q < 5; q++) {
            document.getElementById("img" + (q + 1)).src = "" +
                + ".png";
            document.getElementById("daytemp" + (q + 1)).innerHTML = "Temp: " + Number(fiveDayTemp).toFixed(1) + "°";
            document.getElementById("dayhumid" + (q + 1)).innerHTML = "Humidity: " + Number(fiveDayHumid).toFixed(1);


Is it because I have a second for loop nested in there? I’m not sure why that would only return the last item in the array though. Any feedback will help, thanks!


Simple template suitable for building a webapp backend MVP written in go

Getting error while executing powershell script from powershell