title: javascript switch(true)
body: <p>Hi i am trying to handle an ajax json response</p>
  
  <p>here is my code</p>
  
  <pre><code>success: function (j) {     
      switch(true)
      {
          case (j.choice1):
  
              alert("choice2");
          break;
          case (j.choice2):
                  alert("choice2");
          break;
          default:
              alert("default");
          break;
      }
  }
  </code></pre>
  
  <p>based on what j is return i do my action BUT i keep getting the default.</p>
  
  <p>I have alert the j values and come correct.Some how case (j.choice1) case (j.choice2) is not working.</p>
  
  <p>I tried case (j.choice1!="") (j.choice2!="") But in this scenario i keep getting the first choice.</p>
  
  <p>What am i missing</p>