+ 2
Why the result is 7 ?
var x=7; var y=x++; var z=y++ % x; alert(z);
2 Respostas
+ 6
var x=7;
var y=x++, y will be 7 and after this line x will become 8
var z=y++%x, y is still 7 here and x is 8, so 7%8 is 7, the post increment will work after that line, try print y and it will become 8, what happen there is operator precedence
+ 2
Ok, thanks a lot