0

var x=1; for(x;x<10;x++) x+=x+100; document.write(x);

Why 103?

17th Jul 2020, 1:26 PM
Rohit Ahuja
Rohit Ahuja - avatar
3 Answers
+ 2
x+=x+100 => x+=(x+100) x+=(1+100) x+=(101) x=x+101 x=1+101 x=102 x++ x=103 x<10 false. Prints x : 103
17th Jul 2020, 1:39 PM
Jayakrishna 🇼🇳
0
Thnx
17th Jul 2020, 1:40 PM
Rohit Ahuja
Rohit Ahuja - avatar