Javascript -Debugging

In this challenge it says, stop the loop when i does not equal 4 ( i !=4)
The loop never equals 4 so surely the loop never runs?
but the exercise reads like the loop is infinite?

I don’t understand why the loop isn’t i === 4… although, did i read somewhere this statement always has to be < or > as it’s sort of counting through…as opposed to being just stagnant i guess at this specific point…

so is this why !=4 works because its like the opposite of a fixed point?

…may have just answered my own question…

1 Like

!= 4 does not work. That’s the entire point of the challenge.

In a for loop, we have

for (initialization; loop condition; incrementor) {

The loop runs the initialization, then it executes the body of the loop and then the incrementor until the loop condition is false.

In this case, i != 4 is always false and the loop never stops running.

1 Like

Thanks! sorry, silly question!
I think i was over thinking it!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.