is it best expressional condition?
<p>I am working to get a final value from a function, i have two clickable buttons, one is previous and another is next. for clicking both, i am getting the slide show count. to get this result i am using the following codes. it works better, but till i beleave that, there may be a single line solution for this..</p>

<p>can any one correct this code to minimize ?</p>

<pre><code>var tdLength = 7;
    var num = 0;
    $('a.buttons').click(function(){
        num = ($(this).attr('id') == "next-arrow") ? num +=1 : num -=1;
        num = ( num &gt; tdLength) ? 1 : num;
        num = (num &lt; 1) ? tdLength : num;
        alert(num);
    })
</code></pre>

<p>thanks in advance..</p>
