Why did it print this?


#1



My code
 var getToDaChoppa = function(){
    do {
        console.log("String"+ getToDaChoppa );
    } while(getToDaChoppa===true);
  // Write your do/while loop here!
  
};

getToDaChoppa(false);

It prints:

Getfunction (){
    do {
        console.log("Get"+ getToDaChoppa );
    } while(getToDaChoppa===true);
  // Write your do/while loop here!
  
}


#2

Yup! It will print so because that's what you told it to here:

There you asked it to print "String" and the function itself.

But if it were say:

    var getToDaChoppa = function(){
      do {
          console.log();
      } while (getToDaChoppa === true) {
          console.log("This doesn't work!");
      }
    };

  getToDaChoppa(false);

It will print out:

This doesn't work!

Because it is as long as while is true.

Hope this helps! :smile: