diff --git a/02_selection_sort/javascript/01_selection_sort.js b/02_selection_sort/javascript/01_selection_sort.js index 5102a258..9fce20d1 100644 --- a/02_selection_sort/javascript/01_selection_sort.js +++ b/02_selection_sort/javascript/01_selection_sort.js @@ -8,7 +8,7 @@ function findSmallestIndex(array) { var smallestElement = array[0]; // Stores the smallest value var smallestIndex = 0; // Stores the index of the smallest value - for (var i = 0; i < array.length; i++) { + for (var i = 1; i < array.length; i++) { if (array[i] < smallestElement) { smallestElement = array[i]; smallestIndex = i;