How to optimize my if statements or make less if statements?
<pre><code>if(varName1 &lt;= 1 &amp;&amp; varName1 &gt; 0)
{
$('#id1').addClass('ClassName');
}

if(varName2 &lt;= 2 &amp;&amp; varName2 &gt; 1)
{
$('#id1').addClass('ClassName');
$('#id2').addClass('ClassName');
}


if(varName3 &lt;= 3 &amp;&amp; varName2 &gt; 2)
{
$('#id1').addClass('ClassName');
$('#id2').addClass('ClassName');
$('#id3').addClass('ClassName');
}
</code></pre>

<p>So basically I am wondering if there is a better way to do this with less if statements(8 total with same pattern).</p>
