diff --git a/src/algorithms/sorting/insertion-sort/InsertionSort.js b/src/algorithms/sorting/insertion-sort/InsertionSort.js index ff53c5a6..aa447542 100644 --- a/src/algorithms/sorting/insertion-sort/InsertionSort.js +++ b/src/algorithms/sorting/insertion-sort/InsertionSort.js @@ -21,7 +21,13 @@ export default class InsertionSort extends Sort { this.callbacks.visitingCallback(array[currentIndex - 1]); // Swap the elements. - [array[currentIndex - 1], array[currentIndex]] = [array[currentIndex], array[currentIndex - 1]]; + [ + array[currentIndex - 1], + array[currentIndex], + ] = [ + array[currentIndex], + array[currentIndex - 1], + ]; // Shift current index left. currentIndex -= 1;