leitor de script java

function selection_sort(data) 
{ 
    for(let i = 0; i < data.length - 2; i++) 
    {
        // Finding the smallest number in the subarray
        let min = i;
        for(let j = i+1; j < data.length; j++)
        {
            if(data[j] < data[min]) 
            {
                min = j; 
            }            
         }
         swap_positions(data, i, min);
    }
    return data;
}

function swap_positions(data1, left, right)
{
    backup_old_data_right_value = data1[right];
    data1[right] = data1[left];
    data1[left] = backup_old_data_right_value;
    return data1;
}

let arr = [6, 9, 10, 5, 7, 11, 13, 3, 14, 12];
selection_sort(arr);
document.write(arr);
Combative Cardinal