+ 1

Why is this output '0'? I think the answer is 1

It's question is : What is the output of this code? var x = 100; while (x>=50){ x--; } x%=7; document.write(x); And the answer is 0.

29th Jun 2020, 4:40 AM
Hein Htet Soe
Hein Htet Soe - avatar
1 Odpowiedź
0
The loop doesn't finish until x is not greater equal to 50 (smaller than 50), so x would be 49 after the loop. 49 % 7 = 0
29th Jun 2020, 4:48 AM
你知道規則,我也是
你知道規則,我也是 - avatar