let me know if the question is too vague, but i was trying to turn iterative into recursive function (sorting algo) and i keep getting confused with declaring variables that i then used for iteration, and now want to use for a return/termination condition within the same func. i suppose i could embed a second function in the function but thought i’m probably missing a trick here

```
function selectionSort(array) {
let arrSlice = array
let i=
//for(let i=0;i<array.length-1;i++){
arrSlice = array.slice(i)
const min = Math.min(...arrSlice);
const index = arrSlice.indexOf(min, 0);
[array[i],array[index+i]] = [array[index+i],array[i]];
//selectionSort(?)
i++;
//}
return array;
}
console.log( selectionSort([4,3,2,8,345,123,43,32,5643,63,123,43,55,1,234,92]) )
```