code: function selectionSort(arr) {
  
    /* recursion anchor: one element is always sorted */
    if (arr.length === 1) return arr;
    var minimum = Infinity;
    var index = void 0;
    for (var i in arr) {
      if (arr[i] < minimum) {
        minimum = arr[i];
        index = i; /* remember the minimum index for later removal */
      }
    }
  
    /* remove the minimum */
    arr.splice(index, 1);
  
    /* assemble result and sort recursively (could be easily done iteratively as well)*/
    return [minimum].concat(selectionSort(arr));
  }
docs: /*
  Selection Sort:
  1. Select the minimum and remove it from the array
  2. Sort the rest recursively
  3. Return the minimum plus the sorted rest
  4. An array with only one element is already sorted