To learn it, you gotta 'do' it


#1



https://www.codecademy.com/en/courses/javascript-beginner-en-ASGIv/2/3?curriculum_id=506324b3a7dffd00020bf661#


i got a correct answer but i think it's printed incorrectly


var count = 0;
var getToDaChoppa = function(){
  do {
      console.log("I must eat " + getToDaChoppa + "at least once");
  }

  while (getToDaChoppa < 5);
  getToDaChoppa ++; 
};
getToDaChoppa();


#2

What do you get and what do you expect to get? Also please use different variables for different purposes! You use getToDaChoppa in your output string which creates this rather interesting piece:

I must eat function (){
  do {
      console.log("I must eat " + getToDaChoppa + "at least once");
  }

  while (getToDaChoppa < 5);
  getToDaChoppa ++; 
}at least once

Then you use it inside the condition:

getToDaChoppa < 5

What do you expect this to be? Your lucky that it is false, but did you know this? That:

function (){...} <5

is false?

Also what do you intend by using getToDaChoppa ++; after the while loop? Still getToDaChoppa is a function and not a number and using it to increase the counting variable would be a big danger because this is only reached when you successfully exited the loop. So please use different variables for different purposes.