编辑代码

function selectSort(arr) {
    for(let i=0; i< arr.length - 1; i++) {
        let minIndex = i;
        for(let j = i+1; j < arr.length; j++) {
            if(arr[j] < arr[minIndex]) {
                minIndex = j;
            }
        }
        const temp = arr[i];
        arr[i] = arr[minIndex];
        arr[minIndex] = temp;
    }
}
const arr = [13,2,5,3,55,33,88,5];
selectSort(arr)
console.log(arr)