GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BubbleSort: use Destructuring assignment to swap values (#226) · BrandonWeb/javascript-algorithms@5d12638

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/algorithms/sorting/bubble-sort
    • BubbleSort.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: src/algorithms/sorting/bubble-sort/BubbleSort.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ export default class BubbleSort extends Sort {
1919

2020
// Swap elements if they are in wrong order.
2121
if (this.comparator.lessThan(array[j + 1], array[j])) {
22-
const tmp = array[j + 1];
23-
array[j + 1] = array[j];
24-
array[j] = tmp;
22+
[array[j], array[j + 1]] = [array[j + 1], array[j]];
2523

2624
// Register the swap.
2725
swapped = true;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.