Javascript trying to sort a mixed array numerically
<p>I am trying to sort an array e.g. </p>

<pre><code>arr = ["Joe1,345", "James,1002", "Bill,24"]. 
</code></pre>

<p>I need to order them by number descending but there could be a different amount of numbers on the end. I have tried a bubble sort:</p>

<pre><code>function bubbleSort(a) {
    var swapped;
    do {
        swapped = false;
        for (var i=0; i &lt; a.length-1; i++) {
            if (a[i] &gt; a[i+1]) {
                var temp = a[i];
                a[i] = a[i+1];
                a[i+1] = temp;
                swapped = true;
            }
        }
    } while (swapped);
    return a;
}
</code></pre>

<p>But that didn't work - does anyone know how to achieve this? I've looked at other people doing a similar thing but their answers seem to only have a constant letter in front.</p>

<p>Many Thanks</p>