What is the purpose of index inside the if statement?

Screenshot%20(633)

let SLIDEINDEX = 0;

showSlide(SLIDEINDEX)

function showSlide(index) {

	let picture = document.querySelectorAll('.pictures');

	if (index >= picture.length) SLIDEINDEX = 0;
	if (index < 0) SLIDEINDEX = picture.length -1;

	for (let i = 0; i < picture.length; i++) {
		picture[i].style.display = 'none';
	}

	picture[SLIDEINDEX].style.display = "block";

}

setInterval(function(){showSlide(++SLIDEINDEX)}, 5000);

2 posts were merged into an existing topic: What could be the purpose of index in the if statement?