+ 1

Why does this code alert 1 and not 0?

var a = 13; var b = a--; alert(b-a)

18th Jun 2021, 4:45 PM
Allan 🔥STORMER🔥🔥🔥🔥
Allan 🔥STORMER🔥🔥🔥🔥 - avatar
2 ответов
+ 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
18th Jun 2021, 4:47 PM
The future is now thanks to science
The future is now thanks to science - avatar