HTML5 100
Lösung By theneedyguy on 22nd August 2017 02:47:30 PM
  1. <!DOCTYPE html>
  2. <h2>JavaScript Loops</h2>
  3.  
  4. <p id="demo"></p>
  5. <button onclick="directory()"> Start </button>
  6.  
  7.  
  8. function directory(){
  9.         var array = ['a', 'b', 'c'];
  10.         var index = -1;
  11.         var intervalID = setInterval(function() {
  12.         ++index;
  13.         if (index >= array.length) {
  14.             return;
  15.         }
  16.         // CODE GOES HERE
  17.         document.getElementById("demo").innerHTML = array[index];
  18.         // CODE GOES HERE
  19.         }, 500);
  20. }
  21.  
  22. </body>
  23. </html>

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.