Select Sort

Select Sort assumes the first element as the smallest and compares it to the rest elements of each pass. If it finds smaller, it sets the smallest with the smaller. Each pass fixes its smallest from the lowest index position.

function selectSort(list) {
    for (i = 0; i < list.length-1; i++) {
        var smallest = i;
        for (var j=i+1; j < list.length; j++) {
            if (list[j] < list[smallest]) {
                smallest = j;
            }
        }
        if(i!==smallest) {
            var t = list[i];
            list[i] = list[smallest];
            list[smallest] = t
        }
    }
    return list;
}