question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Switch order of 'Basic Javascript' for- and while-loop lessons

See original GitHub issue

Challenge Name

Iterate with JavaScript For Loops Iterate with JavaScript While Loops

Issue Description

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.

Screenshot

for-while_fcc while-lesson for-lesson-1 for-lesson-2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Bounceycommented, Oct 16, 2016

Sounds reasonable to me

cc @FreeCodeCamp/issue-moderators

1reaction
glowconecommented, Oct 18, 2016

Working on it 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript while and do...while Loop (with Examples)
A while loop evaluates the condition inside the parenthesis () . · If the condition evaluates to true , the code inside the...
Read more >
JavaScript Loops Explained: For Loop, While Loop, Do...while ...
This means that code in a do...while loop is guaranteed to run at least once, even if the condition expression already evaluates to...
Read more >
For, While, and Do...While Loops in JavaScript - KIRUPA
This process repeats iteration after iteration until the condition i < 10 evaluates to false. Since we started the loop with i being...
Read more >
JavaScript while Loop By Examples
Introduction to the JavaScript while loop statement ... The JavaScript while statement creates a loop that executes a block as long as a...
Read more >
Loops: while and for - The Modern JavaScript Tutorial
While the condition is truthy, the code from the loop body is executed. ... A single execution of the loop body is called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found