Hi i am trying to handle an ajax json response
here is my code
success: function (j) { switch(true) { case (j.choice1):
It works for me:
var a = 0, b = true; switch(true) { case a: console.log('a'); break; case b: console.log('b'); break; }
However, the case labels must be equal to true, not jut implicitly true. Also, only the first case that evaluates to true will execute.
case
true