0

Im trying to add a SetTimeOut to a loop but it fails to pause the code Im trying to insert the SetTimeOut to is:

    var temp  = new Array();
    var l = 1; 
    for (var i=coreLines.length-1; i>=0; i--) { 
        l += 1 + Math.floor(coreLines[i].length/displayCols);
        if (l >= displayRows) break
        else temp.push(coreLines[i]);
    }   
Christo
  • 11
  • 6
    You should call `setTimeOut()` recursively...`setTimeOut()` should replace your loop. – brso05 Mar 01 '16 at 21:48
  • 1
    A more appropriate duplicate may be this one - [How do I add a delay in a JavaScript loop?](http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop) – ThisClark Mar 01 '16 at 21:52
  • how u gona pick a duplicate that has duplicates itself and is about a whole nother programming language.. that needs to be changed. – I wrestled a bear once. Mar 01 '16 at 21:54
  • what i cant seem to get my head around is how to incorp the if else.. – Christo Mar 01 '16 at 21:59

0 Answers0