how to declare count so it won't re-declared each click in JavaScript?
<p>i want to make  when that on click will replace to "count is odd!" or "count is even"
but how i should declare count so it won't reinitialized to 1 each click event?</p>

<p>here is what i came with:</p>

<pre><code>    &lt;h1 onclick="var count=1; 
                 if (count%2==1) {
                       this.innerHTML='count is odd!'; count++;}
                 else{     
                 this.innerHTML='count is even';count++;} "&gt;
    Click on this text&lt;/h1&gt;
</code></pre>

<p>now what happens as you can see is that count is one on each click.</p>
