From 448092aebd0c55c31a9a7974fc0d1c892846af97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81?= Date: Thu, 28 Jun 2018 11:45:44 +0300 Subject: [PATCH] i start from 1 --- 02_selection_sort/javascript/01_selection_sort.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;