Sorting of arrays in javascript is so cool and simple! Below you see some code which is used to sort the example array.
Each item in myData
has three properties:
{name:xx, type:xx, rank:##}
Which one you compare will decide how your array is sorted.
You should return either -1
(set a first), 0
(unchanged) or 1
(set b first) .