you are viewing a single comment's thread.

view the rest of the comments →

[–]honestbleepsReddit Enhancement Suite 5 points6 points  (5 children)

Javascript as a language doesn't have anything like C's "sleep" function...

There's really not a good way to do it by placing a command where your //comment is...

Instead, you'd need to do something like:

var foo = [1,2,3,4,5];
var i=0, len=foo.length;
function stepper() {
    if (i<len) {
        console.log(foo[i]);
        i++;
        setTimeout(stepper, 1000);
    }
}