Become a member
to unlock all features

    Create a Selection Sort Function in JavaScript


    While not the fastest sorting algorithm, the selection sort function sorts an array by first creating a new array, calling a function that loops over a list and returns the location of the max/min element, and then pushes that returned indexed value into the newly created array. After the value is added it is then removed from the original list and the process continues until there is nothing left.