0
This Banner is working properly, but I just wanted to understand this account: (bannerAtual + 1) % 3
where q:
'Banneratual = 0'
then, (0 + 1) = 1 % 3 = 0,3333.... someone explains to me why to change 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" />
What exactly is your question? It was not clear in your question
– Diego Marques
And like, how is it working? Why is it changing value from 'Banneratual'' ?
– Soreze martins