Why doesn't this setInterval code work?
<p>I'm trying to change the background color of the body every second but it does not work. What did I do wrong?</p>

<pre><code>var colors = [
    "red", "blue", "green", "yellow", "red"
    ],
    rand = Math.ceil(Math.random() * colors.length - 1),
    t = setInterval(function() {
        document.body.style.backgroundColor = colors[rand];
    }, 1000);
</code></pre>
