From 419a025b70a901758b9e517394fb03bc6f4f1b17 Mon Sep 17 00:00:00 2001 From: Cameron <33632767+Primarch37@users.noreply.github.com> Date: Sun, 3 Jun 2018 15:10:20 -0400 Subject: [PATCH] Extraneous code Thanks for these files! I've been studying them and I think there was extra code in the innermost 'if' condition. --- sorting-algorithms-in-javascript/bubble-sort.es6.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorting-algorithms-in-javascript/bubble-sort.es6.js b/sorting-algorithms-in-javascript/bubble-sort.es6.js index 21d2c2a..61f667d 100644 --- a/sorting-algorithms-in-javascript/bubble-sort.es6.js +++ b/sorting-algorithms-in-javascript/bubble-sort.es6.js @@ -21,7 +21,7 @@ function bubbleSort(array) { do { swapped = false; for(let i = 0; i < array.length; i++) { - if(array[i] && array[i + 1] && array[i] > array[i + 1]) { + if(array[i] > array[i + 1]) { [array[i], array[i + 1]] = [array[i + 1], array[i]]; swapped = true; }