We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 194f213 commit 2ffb7b7Copy full SHA for 2ffb7b7
src/algorithms/sorting/insertion-sort/InsertionSort.js
@@ -21,9 +21,7 @@ export default class InsertionSort extends Sort {
21
this.callbacks.visitingCallback(array[currentIndex - 1]);
22
23
// Swap the elements.
24
- const tmp = array[currentIndex - 1];
25
- array[currentIndex - 1] = array[currentIndex];
26
- array[currentIndex] = tmp;
+ [array[currentIndex - 1], array[currentIndex]] = [array[currentIndex], array[currentIndex - 1]];
27
28
// Shift current index left.
29
currentIndex -= 1;
0 commit comments