From 617f7b07e9d851ad1d6d719fc85d6bc9fc93ba24 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar singh <55596640+saurabhtopthon01@users.noreply.github.com> Date: Thu, 8 Apr 2021 20:26:49 +0530 Subject: [PATCH] Update iterate-through-an-array-with-a-for-loop (#41742) * Update iterate-through-an-array-with-a-for-loop * Update iterate-through-an-array-with-a-for-loop Add space around minus for better readablilty. * Update iterate-through-an-array-with-a-for-loop * Update iterate-through-an-array-with-a-for-loop * Update iterate-through-an-array-with-a-for-loop.md --- .../iterate-through-an-array-with-a-for-loop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 9d1ae06aa2..8dbe697f60 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -18,7 +18,7 @@ for (var i = 0; i < arr.length; i++) { } ``` -Remember that arrays have zero-based indexing, which means the last index of the array is `length - 1`. Our condition for this loop is `i < arr.length`, which stops the loop when `i` is equal to `length`. In this case the last iteration is `i === 4` i.e. when `i` becomes equal to `arr.length` and outputs `6` to the console. +Remember that arrays have zero-based indexing, which means the last index of the array is `length - 1`. Our condition for this loop is `i < arr.length`, which stops the loop when `i` is equal to `length`. In this case the last iteration is `i === 4` i.e. when `i` becomes equal to `arr.length - 1` and outputs `6` to the console. Then `i` increases to `5`, and the loop terminates because `i < arr.length` is `false`. # --instructions--