title: How can i make a click button when do i click make sort(a-b) array and then click again to sort(b-a)
body: <p>Here is my question
  How can i make a click button when do i click make array.sort(x-y) and then click again to make array.sort(y-x)</p>
  <p>i'm already have the function but i'm confuse how to do it...</p>
  <p>let me clarify my question: when do i click on button i make sort to array from bigger to smaller number and then i would like to press on the same button to make the array sort from smaller to bigger</p>
  <p>here is my code:</p>
  <pre><code>$(&quot;.lower&quot;).click(() =&gt; {
      colorsValueMenu(&quot;highest&quot;, &quot;spot&quot;, &quot;gainers&quot;, &quot;losers&quot;, &quot;lower&quot;)
      highest = arrayCoinsD.sort(function (a, b) { return b.quote.USD.percent_change_24h - a.quote.USD.percent_change_24h })
      createCoinDiv(arrayCoinsD, arrayCoinsI)
      $(&quot;.lower&quot;).click(() =&gt; {
          colorsValueMenu(&quot;lower&quot;, &quot;spot&quot;, &quot;gainers&quot;, &quot;losers&quot;, &quot;highest&quot;)
          lower = arrayCoinsD.sort(function (a, b) { return a.quote.USD.percent_change_24h - b.quote.USD.percent_change_24h })
          createCoinDiv(arrayCoinsD, arrayCoinsI)
      })
  })
  </code></pre>
  <p>it's work but just on the first &amp; second time... i want to make it like toggleClass action for every single click</p>