This Banner is working correctly, but only wanted to understand this account: (bannerAtual + 1) % 3
being q:
'BannerAtual = 0'
So, (0 + 1) = 1% 3 = 0,3333 .... does anyone explain to me why to be trading for value = 1 that would be the next array?
var banners = ["imagem 1.jpg","imagem 2.jpg", "imagem 3.jpg"]
var bannerAtual = 0
function trocarBanner(){
bannerAtual = (bannerAtual + 1) % 3
document.querySelector('.destaque_img').src = banners[bannerAtual]
}
setInterval(trocarBanner, 2000)
<img class="destaque_img" />