+ 1
What is the output of this code and how it comes?
var a=1; b=a; alert(-- a + b --);
2 Answers
+ 2
makhrab dip
a = 1
So b would be 1 because b = a
Now --a is pre-decrement so a would be 0
b-- is post decrement which first assign value so b-- would be 1
So finally 0 + 1 = 1
+ 1
Both pre and post decrement should work for substract . Both a and b supposed to be 0 and result 0. Can anyone explain ?