+ 2
I think it's wrong loop? But here I will meet this
var x=1; for (x; x < 10; i++) {} x+=x+100; document.write(x);
10 Respostas
+ 8
put the" }" after document.write(x)
like this
document.write(x) }
and your good.
https://code.sololearn.com/Wm8bDQ7277qu/?ref=app
+ 2
var x=1;
for (x; x < 10; i++) {}
x+=x+100;
document.write(x);
+ 2
sorry guys I mix code I want to know about this code
+ 2
i=0 x=1
i=1 x=2
i=2 x=4
i=3 x=7
i=4 x=11
i=5 x=16
i=6 and that's it, because 6 is not less than 6, its equal :) so x is 16 :)
+ 2
yes but this code I meet in javascript question here)) lol
+ 2
I understand ok
+ 2
I deleted the code because don't look which in code two x but thx guys
0
this code will add each i from 0 to 5 to x that is already set to 1.
so x will be 16. if you wanted to do this then your code is ok
0
@Kristina
that code will create infinite loop of doing nothing. because var i is incrementing and x stays 1 and will never get >= 10. however, there is no code betw parentheses so it will do nothing - forever
0
x will increment 9 times bcz of loop, and will become 10.
so x+=x+100 is x=x+x+100
which means x is 120