08. When to While and When to For Need Help!


#1


This is my code:
for (var i = 0; i < 5; i++){
 console.log(i);
}

var myCondition = function(){

while(myCondition){
 console.log("This finally worked!");
 myCondition = false;
 }
};

The syntax is correct but it is just printing off the numbers 0, 1, 2, 3, 4, 5 and it is not printing off This finally working can someone tell me why!!


#2

You need to call myCondition function in order to print off that string.


#3

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