Javascript setInterval function not defined
<p>What is wrong with this code I seem to be geting an error that timer is not defined</p>

<pre><code>var counter = setInterval("timer()",1000);

            function timer(){
                count = count-1;
                if(count &lt;=0){
                    clearInterval(counter);
                    return;
                }
                document.getElementById("timer").innerHTML = count + " sec";
            }
</code></pre>
