This is an Example/Project from Blog Post: Dynamic Array Sorting in Javascript.

Dynamic Array of Arrays Sorting in Javascript while maintaing the order of arrival for elements with the same value.

A simple Function for Sorting Dynamic Arrays of Arrays in Javascript by the value of one element in the array. Elements with the same value are sorted by order of arrival.
The second element in the array includes the order in which it was evaluated by the function. By using recursion on the function, we are able to maintain this order.

Here is where we'll see the results.

Test

50 Random values from 0 to 10000
Array Lenght: 20

Test

50 Random values from 0 to 10
Array Lenght: 20