javascript switch/case : are types compared?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6989902/is-it-safe-to-assume-strict-comparison-in-a-javascript-switch-statement">Is it safe to assume strict comparison in a Javascript switch statement?</a>  </p>
</blockquote>



<p>Does a switch/case statement in javascript compare types or only values?</p>

<p>In other words, when I have the following code:</p>

<pre><code>switch (variable)
{
    case "0": [...] break;
    case "1": [...] break;
    default: [...] break;
}
</code></pre>

<p>is it equivalent to</p>

<pre><code>if ( variable == "0" )
{
    [...]
}
else if ( variable == "1" )
{
    [...]
}
else
{
    [...]
}
</code></pre>

<p>or to</p>

<pre><code>if ( variable === "0" )
{
    [...]
}
else if ( variable === "1" )
{
    [...]
}
else
{
    [...]
}
</code></pre>

<p>edit: is there a way to force compare values and types at once?</p>
