sorting an array based on time in javascript
<p>I have an array in the format </p>

<pre><code>["09-02-2010", " 05-08-2010", "11-11-2010",  "27-09-2010", "10-12-2010", "09-09-2010", "03-09-2010", "13-08-2010", , "11-10-2010","09-06-2010", "08-06-2010", "07-06-2010" ]
</code></pre>

<p>I am trying to sort the array based on the decreasing order of dates.. </p>

<pre><code>     dateArray.sort( mdyOrdD);

     var dateRE = /^(\d{2})[\/\- ](\d{2})[\/\- ](\d{4})/;

      function mdyOrdD(a, b){
       a = a.replace(dateRE,"$3$1$2");
       b = b.replace(dateRE,"$3$1$2");
       if (a&gt;b) return -1;
       if (a &lt;b) return 1;
       return 0; }
</code></pre>

<p>bt this didnt work our completely.. What could be wrong and is there any other good way to solve this??</p>
