I need help! in this

Tell us what’s happening:

Your code so far


// Setup
var myArray = [];

// Only change code below this line.
var i = 0;
while (i <= 4) {
myArray.push(i);
i++;
}

i need some help i do all combinations try many code even try the solution given but its not working and sometimes it show aw snap we could't load webpage

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36.

Challenge: Iterate with JavaScript While Loops

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops

The test that fails expects the result to be [5,4,3,2,1,0] and your variable has [0,1,2,3,4].

Reverse the while to go from 5 to 0

You need to set the value of i to be 5 i.e. var i=5; then add while condition while(i>=0) and decrease value of i i.e. i-- to pass the test.

I can confirm this is also happening on my end as well. Also, when this happens, the forum also goes down as well.

@camperextraordinaire What is happening is when I opened up the link and start reading the information about this challenge, I get the sudden “aw snap” message popping up. I couldn’t even finish reading a paragraph.

I made that mistake too – I was making a perfectly good array… but not following the directions :wink:

I am using the browser Chrome.

I have tried it again and it did happen, but it didn’t happen immediately like before. For demonstration purpose: this is what is showing on my end:

When it happens, the forum also goes down with it.

I hope this helps.

Well, the first couple of times, it was looking like this before:

But when I tried it again now, it was all good until I have copied and pasted @gautamdhingra’s code in and changed the ++ sign to --, then it happens (hope that made sense).

That would have explained it. I didn’t realise that when even writing the code in the editor, it is actually running the code (I thought to run it is to press ‘Run the Test’ button. My bad!

I see, that does make more sense now (especially I am not currently learning through FCC at this moment). Thank you for explaining this one as I do plan to use the curriculum to learn in near future.

I think it is safe to say when I get to Javascript stage, you will probably seeing more of my posts wailing for help haha. :slight_smile:

Again, thank you.

1 Like

bro i tried that too but whenever i try that a aw,snap page occurs

when ever i try i-- page crash but now its solved i try i-=1 thanks :slight_smile: