Senkora
September 23, 2020, 1:35pm
1
Tell us what’s happening:
Your code so far
// Setup
var myArray = [];
var i = 0;
while(i < 6)
myArray.push(i);
i++;
// Only change code below this line
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
.
Challenge: Iterate with JavaScript While Loops
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
Da_vey
September 23, 2020, 1:51pm
2
compare the code you posted to this code found on the challenge page …
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
2 Likes
Hello there.
Do you have a question?
If so, please edit your post to include it in the Tell us what’s happening section.
The more information you give us, the more likely we are to be able to help.
It is not a potential infinite loop, javascript is being kind (and maybe assuming you have information it lacks. Currently, your one-line while statement is absolutely infinite. It will never reach an escape state. i
never increments.
1 Like