random text from array function

random text from array function

HTML

<div id="container">e</div>

JavaScript

//title: function() { return randomTxt(); }



function randomTxt()
{
    arr = ['why me', 'its a great day', 'youre kidding me', 'forget about it'];
    return arr[Math.floor(Math.random() * 4)];
}




    wordsrun();

function wordsrun() {
    var num = 22, wds = document.getElementById('container');
    window.setInterval(function () {
        // increase by num 1, reset to 0 at 4
        num = (num + 1) % 4;   num = (num + 2) % 4;
$("#container").html(randomTxt(2))

    }, 3000); // repeat forever, polling every 3 seconds
}