I'm using setInterval with jQuery delay.
But the delay() inside setInterval seems not to be working or it does not wait for 3 seconds (in setInterval).
My goal:
- wait 3 seconds first
- print Hello word 10
- then wait 2 seconds to fadeout
- wait 3 seconds
- print hello word 9
- and so on...
The snippet below shows it only waits 2 seconds and prints..
count = 10;
// store setInterval ID in var
var interval = setInterval(function(){
  // log value of count
  console.log(count);
   $('.output').append(
    " hello world"+count+"<br>"
    ).hide().fadeIn(1000).delay(2000).fadeOut('slow');
    if(count <= 0) {
      // if count reaches 10 the clear using interval id
      clearInterval(interval);
    } else {
      // otherwise increment count
         count--;
     }
  }, 3000);<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="output"></div> 
     
     
     
    