11.) When All Three Types of Loops Are Correct


#1

So when all three loops are correctly written out in code on lesson 11 of Introduction to "While" loops nothing will show up in the console log? Or should all three show up in the console log? Love to hear an explanation of it if possible. Code is below:

var brad = function () {
var smart;
do {
smart = false;
console.log('Brad is smart');
} while (smart);

smart = true
while (smart) {
    smart = false;
    console.log('very');
}

for (var i = 0; i < 1; i++) {
    console.log('smart');
}

}


#2

You've nested your loops in a function and that function is not called therefore nothing is executed.


#3

Ah thank you! Just curious. I did not know if that was supposed to happen or it was my error. So I will go correct my error for the sake of curiosity :smiley:


#4

When you use console.log you should see something on the console. So it is a logic error, kind of like a sentence in proper English that just doesn't make sense.


#5

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