Can somebody explain to me in the simplest way possible this code please?

    // hide all the sliders 

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

So, without seeing the code leading up to this, I’m guessing, but… I would imagine that slides is an array of elements, probably div tags, with a common class (maybe class="slide"). What this is doing is looping as many times as there are slides elements, and setting the CSS style display:none on each slide. Typically, this is done to hide all the slides before starting a slide show effect, as the slide show would then display them each, in order, by turning that CSS attribute on (setting style.display = 'inherit' or something similar)

1 Like

thank you so much super useful answer:wink:

1 Like