From e33bda6d5f7b23abb283db11db9f7c74b6f6ee7e Mon Sep 17 00:00:00 2001 From: Andrew Lawendy <22712035+AndrewLawendy@users.noreply.github.com> Date: Sat, 23 Jul 2022 15:14:15 +0200 Subject: [PATCH] refactor(insertion-sort): :recycle: no need to check on j <= 0 --- specs/insertion-sort/insertion-sort.solution.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/insertion-sort/insertion-sort.solution.test.js b/specs/insertion-sort/insertion-sort.solution.test.js index 708f8f75..c66c5af1 100644 --- a/specs/insertion-sort/insertion-sort.solution.test.js +++ b/specs/insertion-sort/insertion-sort.solution.test.js @@ -14,7 +14,7 @@ function insertionSort(nums) { let j; // the inner counter // loop from the right to the left - for (j = i - 1; nums[j] > numberToInsert && j >= 0; j--) { + for (j = i - 1; nums[j] > numberToInsert; j--) { // move numbers to the right until we find where to insert nums[j + 1] = nums[j]; }