use Destructuring in change data (#233)

This commit is contained in:
Silence Tang 2018-10-23 10:45:58 +08:00 committed by Oleksii Trekhleb
parent fad170cfc8
commit fac2d1ff50

View File

@ -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]];
}
}