Iterate with JavaScript For Loops
Iterate with JavaScript While Loops
Consider moving the lesson "Iterate with JavaScript While Loops" to a position before the series of lessons on for-loops, starting at "Iterate with JavaScript For Loops". Currently the single while-loop lesson is placed after the for-loop lessons, but it may be advantageous for students if its made clear that a for-loop is a condensed form of a while loop (especially since the example code in the lessons are synonymous:
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
and:
var ourArray = [];
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
Lesson text in the for-loop lessons could then be updated to make the relationship to while-loops more explicit. It could also be stated that while-loops are used for more than just iterating but if you find yourself iterating with a while-loop, that's a good opportunity to use a for-loop instead.




Sounds reasonable to me
cc @FreeCodeCamp/issue-moderators
Lets move these challenges around :+1:
Remember to take the translations with you :smiley:
Working on it 馃榿
It took much, much longer to setup than to finish coding this...
one other thing - maybe in the wrong place here (please be kind, I'm new around here :) ) - I wonder about the pros and especially the cons of using while at all. It might be wise to note that a misuse of while could result in an endless loop, leaving your page/app broken and eventually kill the whole browser.
If this is the only place where while is explained, I'd appreciate a note on that.
@boneyfantaseas feel free to head over to the Contributors Gitter chat room for a sounding board for curriculum discussions.
thx!
Most helpful comment
Sounds reasonable to me
cc @FreeCodeCamp/issue-moderators