Need explanation about Slideshow code from JS

Can someone explain me this code? What is showDiv’s? I cant find any info on it. And why did he use it. What is “n” he used as argument inside of function? And what does function plusDiv’s do here? What is showDivs(n) of function? Also why did he use if n is higher than x.length and later if n is less than 1? And why did he put x[slideIndex-1].style.display = “block”; in end of function? Im a bit confused here.
https://w3schools.com/w3css/w3css_slideshow.asp

Im referring to both n’s in both functions. What are they? And Why did he call first picture in the beggining by setting slideIndex to 1, why not from 0 since JS counts from 0? Or am i missing something?

So n in function’s names is a given number of slideIndex which is 1? And why did he use if n is less than 1 then slideIndex is set to length of img elements (x.length)? I dont understand that part tbh, wouldnt it be more logical to use if n is smaller than x.length to set slideIndex to x.length? And why is x[slideIndex-1].style.display = "block"; in a very bottom of function showDiv’s? What does this slideIndex-1 mean?

Ok now i understand the if part. In my opinion i believe could would be more understandable if if statements were nested in loop. But idk if that could be a better idea. But one last question i remember that slideIndex-1 has to do with zero based indexing but im curious how it works here, need a bit more clarification of its effect on clicking right or left button. Is there any simmilar code situations and maybe some references i can practice something like this code?