+ 1

How the output is 7?

var x = 7; var y = x++; var z = y++ % x; alert(z); 7 will be alerted. but i don't understand how the z will be 7?

14th May 2017, 5:50 PM
Hasan
2 Respostas
+ 10
x=7 y=7; x=8 z=7%8=7; y=8 alert(z) = 7
14th May 2017, 5:56 PM
Mario L.
Mario L. - avatar
0
learn about prefix, postfix in increment and decrement. it will helps a lots about this concept.
17th May 2017, 2:15 PM
Goku
Goku - avatar