"aww snap" err page, won't run test

Tell us what’s happening:
On lesson 92 of basic JavaScript: iterate with while loops, any test run on code that should produce the right output freezes and redirects me to a page say “aww snap…”. I have written the code in many forms that should produce the right output but every time the page freezes. if i enter the wrong code the tests will run and give me a build fail but the page will not freeze. I have also skipped the lesson and the test ran no problem and gave me the option to continue to the next lesson. Can anybody help me with an explanation. I cleared my cache, restarted me laptop, and am up to date on chrome. Any help is much appreciated. Also the lesson asks me to have the numbers listed in descending order from 5 - 0. In my research on the lesson i noticed it did not put that restriction on other versions of the lesson I researched on youtube to make sure I was doing it right.

Your code so far


// Setup
var myArray = [];

// Only change code below this line.
var i = 5; 
while (i < 6) {
myArray.push(i);
i = i - 1;
}

Your browser information:*

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 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

Makes sense now. I’ll give it a try. The lesson called for the count to run backwards from 5-0 so I thought to set i to 5 and start decreasing by one. The lesson never covered how to run the count backwards. Thanks a ton, the lesson was starting to get the best of me.

With this challenge I was getting the aw snap error with correct code.

I found the key was to create the while loop last after you’ve adjusted your counter correctly, otherwise the while can loop indefinitely whilst you’re trying to type in the counter adjustment. It’s one of the perils of online editing your code is being run/tested as it’s being typed so loops can be dangerous.

1 Like