DEV Community

Discussion on: This simple math hack lets you create an image carousel without any if statements

Collapse
 
ranewallin profile image
Rane Wallin

You could just do the same thing. I.e. nextImg = (currentImage + 1) % imageData.length;