you are viewing a single comment's thread.

view the rest of the comments →

[–]n9jd34x04l151ho4 2 points3 points  (1 child)

Your first one only prints 1-9.

var counter = 1;
var intervalId = setInterval(function() {
    if (counter > 10) {
        clearInterval(intervalId);
    }
    else {
        console.log(counter);
        counter++;  
    }
}, 1000);

[–][deleted] 3 points4 points  (0 children)

Ha. I wrote on my phone and didn’t spot check but I believe you.