Hello, I’ve seen many people struggling with the first exercises. So this thread provides a short summary of information, which could help you.

What is the Math.floor(Math.random() *2) stuff?

There is a nice section in a course of the old track (three different links!), which explains this perfectly. However, the old track isn’t perfect either and there are lots of extremely difficult courses and exercises, too. The posted section is quite doable. All in all the given code in the exercise simulates a coin: When the coin shows 1 , the loop continues, when it shows 0 , the loop stops. The reason for this is in the next quetion:

What is the condition?

If you want the loop to continue, the condition has to evaluate to true . If you want to loop to stop, the condition has to evaluate to false . These are the basics of a while loop. Now you could check, if the condition is true by writing while(condition===true) . However, then you could only use true and false , so you could only use Booleans. But there is a shorthand: while(condtion) . This one allows do the same with less code. That’s good. Even better is the fact, that this code other data types checks and checks, if they would be false : As a general rule you can say, nothing is allways false and something is true . So 0 would be false , 1 would be true . An empty string "" would be false , "Hello!" would be true .

With this knowledge we can understand, why the coin works: The coin can be 0 or 1 . And we know 0 evaluates to false and 1 evaluates to true . And we know false stops the loop and true allows the loop to continue. So as a conclusion: If the coin shows 0 , the loop stops, else it continues flipping the coin.

Now we understand , what we have to do in the second exercise:

understand = true; while(){ console.log("I'm learning while loops!"); understand = false; }

As we know the shorthand while(condition) for while(condition===true) and as we know, what is true (it is understand ; and understand is going to be set false in the loop, so you don’t have an infinite loop), we can conclude, what has to be in the parentheses: understand :

understand = true; while(understand){ console.log("I'm learning while loops!"); understand = false; }

This shorthand is also mentioned later in the section: Here.

Ending

At first I have to say, that the course creation is a work in progress; it will never be finished. So whenever you find something, a bug, an error or something else, press the Send feedback button or report the bug, as it helps them, really. Now the questions: Did I forget anything? Are there any questions left? Does it help you?