Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 488b7a4

Browse files
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‎

Lines changed: 1 addition & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /