title: How to extend the nested ternary operators
body: <pre><code>return a &lt; b ? -1 : a &gt; b ? 1 : 0;
  </code></pre>
  
  <p>The above expression used in array sort by value operation.</p>
  
  <p>How can I extend this ternary operators to avoid non-complaint coding standard (Sonar cube detected this as a Major code smell/non-compliant) ?</p>
  
  <p>Can we do this without using any extra variable?</p>