+ 5
I don't understand result this challenge is 3, help me please!
var i = 0, j = 0, count = 0; for (; i < 3; i++) { for(; j < 3; j++) { count++ } } alert(count);
4 RĂ©ponses
+ 9
The increment only apply for the case:-
â
i = 0, j = 0
â
i = 0, j = 1
â
i = 0, j = 2
only as there's no re-initialization in the inner loop and hence the answer is 3. Tricky! đ
+ 6
Well there's as a loop always comprises of 3 components:-
â
Initialization
â
Condition
â
Update
The usual initialization was moved up to the top in this case.
0
9
0
Why no re-initialization in the inner loop? I still don't understand, on SoloLearn doesn't teach.