7/13 help


not sure what i had done wrong but i damn done messed up
// Example of infinite loop. THIS WILL CRASH YOUR
// BROWSER. Don't run the code without changing it!

for (var i = 1; i >= 10; i++1) {


Browser crashing is a sign of an infinite loop. In your case this doesn't work as expected:


don't know what this specific thing does but it doesn't seem to increase by one. The only confusing this is that this code should not crash your browser but it should not even run as your condition is false:

i >= 10
with i =1 means
1 >= 10

Anyway the correct code to increase a number by one is i=i+i or its shortcuts i+=1 or ++i or i++


thanks, this really helps me in my studies


I am stuck
what is the correct code?
it is mine
for (var i = 10; i = 0; i--) {


Oh i did it.
It was easy


how did you do it without crashing the browser


The code you used (referenced below) is the same that I did. How did you change it to make it work?

for (var i = 10; i = 0; i--) {


for (var i = 10; i == 0; i--) {


Thank you! (Excellent pikachu avatar, btw)


how did you do it plz help


hi sir how are you ?
i have need for your help please solve this lesson.

(12. Loops and arrays II)


for (var i = 10; i = 0; i--)
what am i doing wrong


Just asking:

If you're going to just print 10, what's the use of doing a for loop? Also, if you want to do a for loop that prints the NUMBER, you need to change

To console.log(i). Why? Because it will print the way the number goes until it arrives at 0. Which shows our next problem.

You did your comparators incorrectly in here, specifically:

"=" means something like "turn into" in JavaScript.
"===" means equal to. In type AND value. So, you must change it into "==="

Note: "==" only looks at value, not type. (Just in case you ask) What I am saying is that this is what "==" does:

'1' == 1 //true

But "===" does:
'1' === 1 //false

Hope it helped!:smiley:


for (var i = 10; i = 0; i--)

for loops are as follows

for (initialization ; condition ; incrementation/ decrementation "postfix") { ... }

so try changing your for loop to.

for (var i = 10; i > 0; i--) 

@ragezapper I believe that doing the "==" would never allow the for loop to be true to increment or decrement. So it's best to have the condition replaced so that it can process as I have in the above code.


A post was merged into an existing topic: Hi dear you help me in this problem


Hello there, this is actually the right syntax!
Happy coding :wink:
for (var i = 10; i >= 0; iā€“)


for (var i = 10; i>-1; iā€“) {