0
Please expatiate. What does this code output 4? Thanks!
var x = 8; var y = x++ * 5; var z = y % x; alert(z);
3 Antworten
+ 10
var x = 8;
var y = x++ * 5;
var z = y % x;
alert(z);
y=8*5=40
after this due to post increment property first value is used then incremented so first the value is used in 8*5 which made y=40 and then value of x is incremented by which x=9
so z=40%9= 4
so output is 4
for more information about increment refer this post
https://www.sololearn.com/Discuss/407846/?ref=app
+ 12
what is the value of x without x value this can't possible
0
My Bad, Gawen. it's been corrected.