Skip to content

Commit 488b7a4

Browse files
committed
small refactor in bubble sort for better readablity
1 parent 3e0ac74 commit 488b7a4

File tree

2 files changed

+4266
-1
lines changed

2 files changed

+4266
-1
lines changed

src/algorithms/sorting/bubble-sort/BubbleSort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class BubbleSort extends Sort {
55
// Flag that holds info about whether the swap has occur or not.
66
let swapped = false;
77
// Clone original array to prevent its modification.
8-
const array = originalArray.slice(0);
8+
const array = [...originalArray];
99

1010
for (let i = 0; i < array.length; i += 1) {
1111
swapped = false;

0 commit comments

Comments
 (0)