+ 1
Assignment and increment
Explain Why following code alerts 5 and not 6. I know it applies assignment first and increment next. https://code.sololearn.com/WfFESf1hUsox/?ref=app
4 Respuestas
+ 7
https://stackoverflow.com/questions/7911776/what-is-x-after-x-x
+ 4
https://www.codecademy.com/en/forum_questions/514995a07272221a5b001f32
Here it is nicely explained
+ 3
var x=5;
x= x++;
//x++ does not increment because the value here is: 5
+ 2
In the post he said x++ evaluates to x and hence old value is assigned to x. But after assignment increment operator should execute and increase the value of x by 1 right?