I have read on w3schools:
The setInterval() method will wait a specified number of milliseconds, and then execute a specified function, and it will continue to execute the function, once at every given time-interval.
The setTimeout() method will wait the specified number of milliseconds, and then execute the specified function.
I tried them both. However, that is not what I need.
I want a function that will loop continuously until the time duration is reached.
Is there a workaround on this? Thanks!