When to 'while' and when to 'for'


This not how my Saturday is suppose to start.


It passes but it does not execute my first line of code but not my second paragraph of code

var condition = true;

while(condition) {
    console.log("Looped once")
    // Do while condition is true
    condition = false;

var i = 1;

for (var i = 1; i < 11; i++) {
    // Print the numbers 1 - 10


both the while and for loop are executed:

everything is good, what is the problem?


it just runs the second part of the code,the "for" loop only.


well, i see Looped once in the console (running your code), so the while loops runs as well. Both run. Maybe scroll in your console window? It is there


nothing.. just the numbers. Its fine though, it passed me through without running it.


okay, lets run it outside of codecademy, for example here (that is your code), i see looped once


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.