+ 1
Why does this code alert 1 and not 0?
var a = 13; var b = a--; alert(b-a)
2 Answers
+ 6
Because,
in this code,
the value of b becomes 13 not 12 because it is a-- not --a.
and the value of a becomes 12
so b-a=13-12=1
See the last part of this lesson:
https://www.sololearn.com/learn/JavaScript/1130/?ref=app