Lesson 10. To learn it you gotta do it


#1

Don't know why is keeps looping through the script.
This is the lesson https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/2/3?curriculum_id=506324b3a7dffd00020bf661
My error is I keep getting an unresponsive script
my code:

var number = 150;
var getToDaChoppa = function(){
  do {
      console.log("There are " + number + " minutes in two hours and thirty minutes.");
}
  while (number) {
  number++;
}
}
getToDaChoppa();

#2

Just to turn your question on its head:
Explain to me why it would stop looping.


#3

I thought it said that the do loop automatically makes it stop looping?


#4

Automatically? How does it know when to stop? Just run once and then stop? That wouldn't be a loop would it?


#5

Idk, how do I stop the loop for a number then?


#6

Do you know what determines when a do-loop stops?
Otherwise, you should look that up, because if you don't know "what goes where" then it's just guesswork, right?

If the problem is that you don't know what a do-loop should look like, then you know exactly what information that you're missing and you're just a google search away from setting things straight.

If you do know how it looks, then you'll have to be more specific in your question - because "stop for a number" would be exactly the same way as how it is stopped for anything else, making your question super unclear! Gotta be specific about what you want to know.


#8

The idea for this is to... "do" this function until it's either true or false. For example.
var x = 0;
do{
console.log("print something while x = 0");
}while(x){
x++;
}
When the value of x changes the do function will cease