Tell us what’s happening:
Change the while loop in the code to a do...while loop so that the loop will push the number 10 to myArray , and i will be equal to 11 when your code finishes running. My code will not pass the test. Please help.
Your code so far
// Setup
var myArray = [];
var i = 10;
// Only change code below this line.
do {
myArr.push(i);
i++;
} while (1 < 10);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.
// Setup
var myArr = []; //check that variable names are spelled properly
var i = 10;
// Only change code below this line.
do {
myArr.push(i);
i++; // changed 1 to 11
} while (i < 10); // since i started at 10 the loop will end before it does anything
// while (i < 11); // runs as long as i is less than 11
// while (i <= 10); // also works
i can’t believe anybody learns from FCC. more often than not i get the answer, paste it in, and then TRY and understand it. I learn more from udemy courses.