From a52b5b4ebb814300fd5bceadcbe2d3bc8c5f42a5 Mon Sep 17 00:00:00 2001 From: PartyLich Date: Wed, 6 Nov 2019 12:51:59 -0500 Subject: [PATCH] feat: rewrite Iterate with JavaScript While Loops challenge (#37697) * feat: rewrite Iterate with JavaScript While Loops challenge Previous example in the challenge description was the exact code that challenge instructions say to implement. Change the challenge to differentiate from the example. resolve freeCodeCamp/freeCodeCamp#37694 * fix: update iterate with javascript while loops solution * refactor: improve iterate with js while loops challenge wording Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> --- .../iterate-with-javascript-while-loops.english.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.english.md index 0021026bd9..fd8184cfc3 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.english.md @@ -25,7 +25,7 @@ Let's try getting a while loop to work by pushing values to an array. ## Instructions
-Push the numbers 0 through 4 to myArray using a while loop. +Add the numbers 5 through 0 (inclusive) in descending order to myArray using a while loop.
## Tests @@ -35,8 +35,8 @@ Push the numbers 0 through 4 to myArray using a while tests: - text: You should be using a while loop for this. testString: assert(code.match(/while/g)); - - text: myArray should equal [0,1,2,3,4]. - testString: assert.deepEqual(myArray, [0,1,2,3,4]); + - text: myArray should equal [5,4,3,2,1,0]. + testString: assert.deepEqual(myArray, [5,4,3,2,1,0]); ``` @@ -76,10 +76,10 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();} ```js var myArray = []; -var i = 0; -while(i < 5) { +var i = 5; +while(i >= 0) { myArray.push(i); - i++; + i--; } ```