Javascript executing more than one case in if else statement
<p>I have a curious problem with some javascript.  In the following code the browser will execute more than one path in the if, else if, else if conditions.  So for example the console will log "a c" or "b c".</p>

<pre><code>if (divs[i].row == hover_div.row &amp;&amp; divs[i].obj != hover_div.obj)
{
    console.log("a");
    divs[i].obj.stop()
        .animate({'width':d_thin}, { duration:600, queue:false })
        .animate({'height':d_expand}, { duration:600, queue:false });
}
else if (divs[i].col == hover_div.col &amp;&amp; divs[i].obj != hover_div.obj)
{
    console.log("b");
    divs[i].obj.stop()
        .animate({'width':d_expand}, { duration:600, queue:false })
        .animate({'height':d_thin}, { duration:600, queue:false });
}
else if (divs[i].obj != hover_div.obj);
{
    console.log("c");
    divs[i].obj.stop()
        .animate({'width':d_thin}, { duration:600, queue:false })
        .animate({'height':d_thin}, { duration:600, queue:false });
}
</code></pre>

<p>I've checked that the code isn't executing twice by adding a counter just outside the block. If I nest the if statements as below the whole thing works fine, but I shouldn't need to should I?</p>

<pre><code>if (divs[i].row == hover_div.row &amp;&amp; divs[i].obj != hover_div.obj)
{
    console.log("a");
    divs[i].obj.stop()
        .animate({'width':d_thin}, { duration:600, queue:false })
        .animate({'height':d_expand}, { duration:600, queue:false });
}
else {
    if (divs[i].col == hover_div.col &amp;&amp; divs[i].obj != hover_div.obj)
    {
        console.log("b");
        divs[i].obj.stop()
            .animate({'width':d_expand}, { duration:600, queue:false })
            .animate({'height':d_thin}, { duration:600, queue:false });
    }
    else {
        if (divs[i].obj != hover_div.obj);
        {
            console.log("c");
            divs[i].obj.stop()
                .animate({'width':d_thin}, { duration:600, queue:false })
                .animate({'height':d_thin}, { duration:600, queue:false });
        }
    }
}
</code></pre>
