mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 07:01:18 +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 (minIndex !== i) {
|
||||
const tmp = array[i];
|
||||
array[i] = array[minIndex];
|
||||
array[minIndex] = tmp;
|
||||
[array[i], array[minIndex]] = [array[minIndex], array[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user