+ 1

Find the result? And why?

first case: var i = 0; while (i < 10) { i = i + 1; } document. write(i); ------------------------- second case: var i = 0; while (i < 10) { document. write(i); i = i + 1; } -------------------------

12th Oct 2018, 9:34 PM
Bassam Maqboul
Bassam Maqboul - avatar
2 Respuestas
+ 1
First case: result will be ' i ' (10). The condition in the will case will be false until the last instruction executed. Second case: result will be ' i ' ten time cause the write instructions will be executed for (0,1,2,3,4,5,6,7,8,9).
12th Oct 2018, 10:16 PM
. H .
+ 1
This should be posted to your feed.
12th Oct 2018, 11:32 PM
qwerty
qwerty - avatar