What this -1 does in this javascript code?

because i’m pretty sure the line over that -1 adds one more slide:
if (slideIndex > slides.length) {slideIndex = 1}

But the -1 just looks weird to me

changes the value of the className that is 1 space left of slideIndex in dots to "active"
`