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 fac2d1f

Browse files
SilenceMMMMMMtrekhleb
authored andcommitted
use Destructuring in change data (trekhleb#233)
1 parent fad170c commit fac2d1f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

‎src/algorithms/sorting/selection-sort/SelectionSort.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export default class SelectionSort extends Sort {
2323

2424
// If new minimum element has been found then swap it with current i-th element.
2525
if (minIndex !== i) {
26-
const tmp = array[i];
27-
array[i] = array[minIndex];
28-
array[minIndex] = tmp;
26+
[array[i], array[minIndex]] = [array[minIndex], array[i]];
2927
}
3028
}
3129

0 commit comments

Comments
(0)

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