mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 15:11:16 +08:00
use Destructuring in change data (#233)
This commit is contained in:
parent
fad170cfc8
commit
fac2d1ff50
@ -23,9 +23,7 @@ export default class SelectionSort extends Sort {
|
|||||||
|
|
||||||
// If new minimum element has been found then swap it with current i-th element.
|
// If new minimum element has been found then swap it with current i-th element.
|
||||||
if (minIndex !== i) {
|
if (minIndex !== i) {
|
||||||
const tmp = array[i];
|
[array[i], array[minIndex]] = [array[minIndex], array[i]];
|
||||||
array[i] = array[minIndex];
|
|
||||||
array[minIndex] = tmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user