A SelectionSort algorithm
The sort works by iterating through the array starting from the beginning.
Each item is compared to every subsequent item in the array to determine
which is smaller. Either the current item is kept or a smaller item is
swapped into its spot. This repeats until the order of items is arranged
from smallest-to-largest.
array
(*[]): the input array[comparator]
(Function): a function to compare2
values *(defaults asc->desc)*[step]
(Function): an optional function that gets applied at each step
(*): the sorted array