+ 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 Antworten
+ 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.