diff --git a/src/algorithms/sorting/bubble-sort/BubbleSort.js b/src/algorithms/sorting/bubble-sort/BubbleSort.js index 4d3f1569..d78ebcbd 100644 --- a/src/algorithms/sorting/bubble-sort/BubbleSort.js +++ b/src/algorithms/sorting/bubble-sort/BubbleSort.js @@ -19,9 +19,7 @@ export default class BubbleSort extends Sort { // Swap elements if they are in wrong order. if (this.comparator.lessThan(array[j + 1], array[j])) { - const tmp = array[j + 1]; - array[j + 1] = array[j]; - array[j] = tmp; + [array[j], array[j + 1]] = [array[j + 1], array[j]]; // Register the swap. swapped = true;