I do not find any mistakes here. I tried to check and find the answer several times. Can you please check what my mistake is here?
Here is the HTML
<div class="slideshow"></div>
JS File
// slideshow
const slideshowDivs = () => {
for (let i = 1; i <= 5; i++) {
const div = document.createElement("div");
div.style.backgroundImage = `url(Final/images/slideshow/section-1-bg-${i}.jpg)`;
i === 1 && div.classList.add("change");
document.querySelector(".slideshow").appendChild(div);
}
};
slideshowDivs();
const divs = document.querySelectorAll(".slideshow div");
let a = 1;
const slideshow = () => {
setInterval(() => {
a++;
const div = document.querySelector(".slideshow.change");
div.classList.remove("change");
if (a < divs.length) {
div.nextElementSibling.classList.add("change");
} else {
divs[0].classList.add("change");
a = 1;
}
}, 1000);
};
slideshow();
// end of the slideshow