Jump to content

The "n" in function showSlides(n)?


SBl

Recommended Posts

Hello,

as a relative new beginner I don't get a full understanding of the working of this functions below concerning the creation of a Slideshow (https://www.w3schools.com/howto/howto_js_slideshow.asp ). 

Especially how the "n" is initially defined: what is the first value for n in this example? In the function showSlides(n) there is the IF-request: if (n > slides.length ….) - but what is the value for n at this Point? I can't find any start value for this n line n = 1 - so how can IF decide this comparison?

Thanks

 

 

image.png.cc9a1d7f1c32c85494282f736993b950.png

Link to comment
Share on other sites

thanks - yes, I understand that n is the Parameter in that function - the Point is: in the whole Code for that slide nowhere n is getting any value - there is never defined any concrete value for that n e. g. showSlides(3) like in your example - so how compare that n in the IF-Question? n must have a value - I know - otherwise this script wouldn't work, but I can't figure out where it comes from.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...