function theVeryRealSelectionSort(array) { let counter = 0; while (counter < array.length) { for (let i = 1; i < array.length; i++) { if (array[i] < array[i-1]) { let temp = array[i-1]; array[i-1] = array[i]; array[i] = temp; } } counter += 1; } return array; } const notSortedArray = [32, 34, 244, 7, 45, 57, 234, 5, 90, 35, 3546, 567, 32]; const sorted = theVeryRealSelectionSort(notSortedArray); console.log(sorted);