# The suggested answer in curriculum is wrong

**URL:** <https://forum.freecodecamp.org/t/the-suggested-answer-in-curriculum-is-wrong/427912>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [October 30, 2020, 5:05am UTC](https://forum.freecodecamp.org/t/the-suggested-answer-in-curriculum-is-wrong/427912 "2020-10-30T05:05:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pzb00713213](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pzb00713213/32/185063_2.png) [@pzb00713213](https://forum.freecodecamp.org/u/pzb00713213)\
**Post date:** [October 30, 2020, 5:05am UTC](https://forum.freecodecamp.org/t/the-suggested-answer-in-curriculum-is-wrong/427912/1 "2020-10-30T05:05:48Z")

</div>

This is the suggested answer website.

> [@freeCodeCamp Challenge Guide: Iterate with JavaScript While Loops](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-iterate-with-javascript-while-loops/18220):
>
> [Iterate with JavaScript While Loops](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops)Problem Explanation While loops will run as long as the condition inside the ( ) is true. Example: while (condition) { //code... } Hints Hint 1 Use a iterator variable such as i in your condition let i = 5; while (i \>= 0) {} Solutionsplay_button Solution 1 (Click to Show/Hide)

The correct answer should be:

```auto
var myArray = [];

var i=0;

while(i<6){

    myArray.push(i);

    i++;

}

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [October 30, 2020, 7:08am UTC](https://forum.freecodecamp.org/t/the-suggested-answer-in-curriculum-is-wrong/427912/2 "2020-10-30T07:08:37Z")

</div>

your solution doesn’t pass this test:

> `myArray` should equal `[5,4,3,2,1,0]`

* * *

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](http://www.freecodecamp.com/forum/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (').

---

<div class="post-metadata">

**Author:** ![pzb00713213](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pzb00713213/32/185063_2.png) [@pzb00713213](https://forum.freecodecamp.org/u/pzb00713213)\
**Post date:** [October 30, 2020, 7:18am UTC](https://forum.freecodecamp.org/t/the-suggested-answer-in-curriculum-is-wrong/427912/3 "2020-10-30T07:18:34Z")

</div>

Ohh, suddenly I got it. Sorry for the inconvenient cause, this is my first post.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 10:36am UTC](https://forum.freecodecamp.org/t/the-suggested-answer-in-curriculum-is-wrong/427912/4 "2021-06-01T10:36:21Z")

</div>


