function selectionSort(array) { // loop through all elements except last in array for(let i=0;i