Looping through functions

I thought looping through functions would be pretty easy but i’ve been working on it for some time now and haven’t managed to make it work.

What i wanna do is:

  1. Run function 1
  2. After 40 secs run function 2
  3. After 80 secs run function 3
  4. After 120 secs run function 4
  5. After 160 secs run function 1 again
  6. Back to step 2

Maybe i confused you with these steps, what i mean is i wanna run a function and wait 40 secs before running the next.

And basically i want this to go on forever. I’ve tried some stuff with setTimeout and setInterval, maybe i used them in a wrong way, but as i said i didn’t manage to make it work.

Thanks a bunch.