title: switch vs if-else branching control structure in Node.JS
body: <p>Which one is good to use when there is a large number of branching flow in Node.JS Program.</p>
  
  <p>switch</p>
  
  <pre><code>switch(n)
  {
  case 1:
    execute code block 1
    break;
  case 2:
    execute code block 2
    break;
  default:
    code to be executed if n is different from case 1 and 2
  }
  </code></pre>
  
  <p>OR<br>
  if-else</p>
  
  <pre><code>if (condition1)
    {
      execute code block 1
    }
  else if(condition2)
    {
      execute code block 2
    } 
  else
    {
       code to be executed if n is different from condition1 and condition2
    } 
  </code></pre>