BubbleSort: use Destructuring assignment to swap values (#226)

* BubbleSort: use Destructuring assignment to swap values

* lint: add semi
This commit is contained in:
Sid 2018-10-17 11:13:27 +08:00 committed by Oleksii Trekhleb
parent 044441e259
commit 5d12638ab5

View File

@ -19,9 +19,7 @@ export default class BubbleSort extends Sort {
// Swap elements if they are in wrong order.
if (this.comparator.lessThan(array[j + 1], array[j])) {
const tmp = array[j + 1];
array[j + 1] = array[j];
array[j] = tmp;
[array[j], array[j + 1]] = [array[j + 1], array[j]];
// Register the swap.
swapped = true;