11 - Review


#1


I would like to know why "testing do loop" doesn't print. I only get this.
1
10
100
Take a break !
false

Here is the code I wrote.

// Write your code below!
for (var x=1; x < 1000; x=x*10) {
    console.log(x);
    }

var tired = true;

while (tired) {
    console.log("Take a break !")
    tired = false;
    }

var mad = function() {
    do {
        console.log("Testing Do Loop!");
        } while(false)
    }

Thank you!


#2

because you have x * 10 each time it loops through and you have it set to stop at 1000

* is manipulation


#3

I'm sorry, I really don't get it..

I was talking about that bit of code:

var mad = function() {
do {
console.log("Testing Do Loop!");
} while(false)

Which prints "false" instead of "testing do loop" as I expected.


#4

The false that you are seeing is coming from this:

tired = false;

That was the last value assigned.

You are not seeing any output from your mad function because, while you have defined it, you haven't called it yet.


#5

As @albionsrefuge mentioned, you just defined it without calling it.

mad(); to the end of your code should fix it.


#6

Thank you very much ! I had completly forgot to call it back! Thanks a lot!