https://javascript.plainenglish.io/display-7-day-weather-forecast-with-openweather-api-aac8ba21c9e3
I'm having trouble implementing this into my project. I can't get it to display weather on the page. I believe I need to render it to the page?
forecastEl[0].classList.add('loaded');
response.json().then(function (data) {
var fday = "";
data.daily.forEach((value, index) => {
if (index > 0) {
var dayname = new Date(value.dt * 1000).toLocaleDateString("en", {
weekday: "long",
});
var icon = value.weather[0].icon;
var temp = value.temp.day.toFixed(0);
fday = `<div class="forecast-day">
<p>${dayname}</p>
<p><span class="ico-${icon}" title="${icon}"></span></p>
<div class="forecast-day--temp">${temp}<sup>°C</sup></div>
</div>`;
forecastEl[0].insertAdjacentHTML('beforeend', fday);
}
});
});
Thank you!