9th May 2018, 6:21 AM
Ogi Gina Permana
Ogi Gina Permana - avatar
2 Answers
+ 3
var x= 6; var y= 0; while (x>0 && y<6) { x--; y=y+x } document.write(y);// result 9 At first y is 0 then x is decreased to 5, so y=0+5=5 then x is decreased to 4 so y=5+4=9 since y is now 9 and 9 is not <6, loop stops running. answer is 9
9th May 2018, 6:50 AM
᠌᠌Code X
᠌᠌Code X - avatar
0
thank brains for your explanation
28th May 2018, 7:54 PM
Ogi Gina Permana
Ogi Gina Permana - avatar