title: why should we parse value in switch condition but not in if condition?
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function runif() {
    let a = document.getElementById('test').value;
    if (a == 1) {
      console.log("works");
    }
  }
  
  function runswitch() {
    let a = document.getElementById('test').value;
    switch (a) {
      case 1:
        console.log("working");
        break;
  
      default:
        break;
    }
  }
  
  function runswitchOne() {
    let a = parseInt(document.getElementById('test').value);
    switch (a) {
      case 1:
        console.log("working");
        break;
  
      default:
        break;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action=""&gt;
    &lt;input type="text" id="test"&gt;
    &lt;input type="button" onclick="runif()" value="click to check if"&gt;
    &lt;input type="button" onclick="runswitch()" value="click to check without parseInt"&gt;
    &lt;input type="button" onclick="runswitchOne()" value="click to check with parseInt"&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is the form I have created with a text input and two buttons.</p>
  
  <p>In which the if statement recognize the input and does operation</p>
  
  <p>But in switch I have to make it parse to recognize</p>
  
  <p>I do not understand why it works? I know text input gives sting but if so how if() statement works without parsing?</p>
  
  <p>normally we use if(a == "1") to compare string and not if(a==1)?</p>
  
  <p>but even so it works</p>