function solution(unsorted) {
for (let i = 1; i < unsorted.length; i++) {
const temp = unsorted[i];
let j = i - 1;
while (j >= 0) {
if (unsorted[j] > temp) {
unsorted[j + 1] = unsorted[j];
} else break;
j--;
}
unsorted[j + 1] = temp;
}
return unsorted;
}
const result = solution([11, 7, 5, 6, 10, 9]);
console.log(result);