¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
Why is class list and add not working??
Line 12 gives me and error yet that's how I wrote it in Vscode and it's working https://sololearn.com/compiler-playground/W0SuAw97u718/?ref=app
2 Respuestas
+ 1
there is only one ".nav-dots", hence slidesIcon has the length 1.
and what should happen for slideIndex > 2?
0
document.querySelectorAll(".nav-dots"); should be changed to document.querySelectorAll(".slide-icon");
And also the Event handler is wrong in so many ways
slideIndex needs to be limited as << slides[slideIndex] >> is bound to be undefined if slideIndex=>3
Take a look
https://sololearn.com/compiler-playground/W7MA69v8x1Sw/?ref=app