I was thinking of a project to test skills, over a loading bar and I thought, we were able to undo a modification on a page normally, but did the opposite process? for example, we have an automatic slideshow, every 1 second he changes image, always moving forward, but when do we get to the end of the slideshow? usually, it returns the whole process in a single time, throwing us back to the first slide, but what if, at the end of the slideshow, we perform the reverse process, returning every second, an image, and at the end of it, the process, how could this be done?
EX:
I need to execute a function repeatedly until I reach the objective, when I reach the objective, I need to call another function, which will execute the inverse of the previous one, which in turn, when it finishes, will call the first function again.