FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

small refactor in bubble sort for better readablity · dann95/javascript-algorithms@488b7a4 · GitHub

Repository navigation

Commit 488b7a4

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

2 files changed

Lines changed: 4266 additions & 1 deletion

File tree

‎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)

Back | FazBrowse Home | New Git URL