To learn it, you gotta 'do' it unexpected output and expected infinite loop


var getToDaChoppa = function(number){
// Write your do/while loop here!
do { console.log(number + "is a number!")
while (number > 2) {
console.log("It is also bigger than 2");

When i give getToDaChoppa() value of 1(or any number not higher than 2) it does the while statememnt even though i don't want it to but otherwise i pass the lesson (and i shouldn't) , but when i give it a value that is greater than 2 then i get an infinite loop i really need help from somebody on this.


You incorrectly made a do-while loop. Syntax:

do {
    //Increment/Change Condition
} while (condition);


Could you show me an example with the existing code because i don't fully understand the error


do {
    console.log(number + " is a cool number!");
} while (number < 100);


Oh i misunderstood the entire concept . So if i write a while loop it will run when the conditions meet if i write a do/while loop the do part will keep running infinitely until the while condition is met ? Hence no command is written after the while condition ? p.s. is it possible to write a additional command after the while condition for it to additionally do something when the do/while loop stops ?


var getToDaChoppa = function(number);{
// Write your do/while loop here!
do { console.log(number + "is a number less than two!")
while(number < 2);

So i did it like this . But i get syntax error and for the love of god i don't understand why


No semicolon needed.