title: Javascript - Ternary Operator with Multiple Statements
body: <p>Is this valid JavaScript?  I saw an example where someone used commas in the ternary operator conditions, and it was marked as an error in my editor, and the example didn't run in Chrome.  However, it did run in Firefox.  Once I converted all the ternary statements to if/else statements, the app ran on Chrome.   </p>
  
  <pre><code>a!==b ? (a=1, b=2) : (a=2, b=1)
  </code></pre>
  
  <p>Edit:</p>
  
  <p>This is the actual statement in the code:</p>
  
  <pre><code>a!==0?b&lt;0?(h=b/a,e=h-1,f=-2*b+2*a*e,i=-2*b+2*a*h,d=2*h*a-2*b-2*a):(h=b/a,e=h+1,f=2*b-2*a*e,i=2*b-2*a*h,d=-2*h*a+2*b):d=h=e=f=i=0
  </code></pre>