Practice Counting Down


#1

// Example of infinite loop. THIS WILL CRASH YOUR
// BROWSER. Don't run the code without changing it!

for (var i = 10; i >= 10; i-=1) {
console.log(i);
}
What's wrong in the above code


#2

the loop will run as long the condition is true.

10 is greater or equal to 10, true, loop runs
9 is greater or equal to 10, false, loop exit

I think you might need to change your condition.


#3

Can you please write condition here


#4

this is the condition you have:

 i >= 10

which as we just determined isn't really working well, if you want to count down to 5 you will get something like:

 i >= 5

the condition depends on what the exercise is asking of you


#5

// Example of infinite loop. THIS WILL CRASH YOUR
// BROWSER. Don't run the code without changing it!

for (var i = 10; i >= 0; i-=1) {
console.log(i);
}
ThIS WORKED.