I am trying to get a jQuery snippet to loop around and keep displaying the messages in the array. This is what I have so far and it works, it just won't loop round after once even though I used setTimeout function.
What am I doing wrong? What would be best practice and why?
Thanks in advance
    var obj = $("div");
    var arr = $.makeArray(obj);
    var len = arr.length;
    var i = 0;
    function printloop() {
        arr[i].style.display = "block";
        i++;
        if (i < len) {
            setTimeout(printloop, 2000);
        } else {
            setTimeout(function() {
                    $("div").css("display", "none");
            },1000);
        };
    }
    printloop();
    setInterval(prinloop, 20000);
 
     
     
    