is it possible to pass percentDiscount as parameter?
<p>If I had this: </p>

<pre><code>var percentDiscount;

function calculate(sale, original) {

percentDiscount = Math.round(eval(((original-sale)/original) * 100));

    return percentDiscount;
}

$(document).ready(function() {

var salecost;
var originalcost;
var percent;
$('.product').each(function() {

    salecost = $(this).find('.price').html();
    salecost = salecost.replace(/[^\d\.]/g, "");


    originalcost = $(this).find('.actualprice').html();
    if(originalcost == null) return;
    originalcost = originalcost.replace(/[^\d\.]/g, "");

    percentDiscount = calculate(salecost, originalcost);

   if (69 &lt; percentDiscount &amp;&amp; percentDiscount &lt; 101) {

        $(this).find("#percentoff").html('&amp;gt; 70% off');
        $(this).find("#percentoff").addClass('badge70');
    }

    else if (49 &lt; percentDiscount &amp;&amp; percentDiscount &lt; 70) {

        $(this).find("#percentoff").html('&amp;gt; 50% off');
        $(this).find("#percentoff").addClass('badge50');
    }

    else if (29 &lt; percentDiscount &amp;&amp; percentDiscount &lt; 50) {

        $(this).find("#percentoff").html('&amp;gt; 30% off');
        $(this).find("#percentoff").addClass('badge30');
    }


    else if (19 &lt; percentDiscount &amp;&amp; percentDiscount &lt; 30) {

        $(this).find("#percentoff").html('&amp;gt; 20% off');
        $(this).find("#percentoff").addClass('badge30');
    }


});
});
</code></pre>

<p>Is it possible to pass <code>percentDiscount</code> so that I could sort the discount on the page? for the example, sort by % discount: [all] [20%] [30%] [50%] [70%] and then match the calculation of each item to be displayed by discount?</p>

<p>If it is possible, please give me example on how it should be coded or sorted? I searched for possible answer on this but no avail. all I saw most is xxx.sort() but it wouldn't work for percentage discount... </p>

<p>
Another question - I wanted to know how to sort by link applying to the url to match the percentage discount as well. Then how to skip the items that are not on sale?</p>
