let insertionSort = (arr) => { for (let i = 0; i < a.length; i++) { let toCmp = arr[i]; for (let j = i; j > 0 && toCmp < a[j - 1]; j--) arr[j] = a[j - 1]; arr[j] = toCmp; } return arr; }