From fac2d1ff5073fd8ab2787856b0a2488aeb111c09 Mon Sep 17 00:00:00 2001 From: Silence Tang Date: Tue, 23 Oct 2018 10:45:58 +0800 Subject: [PATCH] use Destructuring in change data (#233) --- src/algorithms/sorting/selection-sort/SelectionSort.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/algorithms/sorting/selection-sort/SelectionSort.js b/src/algorithms/sorting/selection-sort/SelectionSort.js index 1b066aff..fa4a720b 100644 --- a/src/algorithms/sorting/selection-sort/SelectionSort.js +++ b/src/algorithms/sorting/selection-sort/SelectionSort.js @@ -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]]; } }