insertion sort
let arr = [2, 4, 1, -4, 9, 3, 45, -6, 0, 5];
console.log(insertionSort(arr));
function insertionSort(arr) {
for(let firstUnsortedIndex = 1; firstUnsortedIndex < arr.length; firstUnsortedIndex++) {
let newElement = arr[firstUnsortedIndex];
let i;
for(i = firstUnsortedIndex; arr[i - 1] > newElement; i--) {
arr[i] = arr[i-1];
}
arr[i] = newElement;
}
return arr;
}