Object Sort

A sorting function for objects

This is sorting function operates on arrays of objects and sorts them according to their object properties.  Objects can be sorted in descending or ascending order.

In the example, dummy objects are created and put into an array. The resulting array is then sorted based on the properties of the objects.

Function included: ObjectSort(arr, prop, dir).
arr – the array to be sorted.
prop – property of the objects in the array.
dir – +1 to sort in ascending, -1 to sort in descending direction.

No return value is passed back, instead the input array is sorted directly and can be accessed as normal.