+ 2

Can you explain these codes plz anf what is differnet between them??

var a = 3 function b(){ a++ alert(a) } b() & var a = 3 alert(a++) in the first shows 4 and in the second one shows 3

24th Apr 2018, 7:10 PM
Sina
Sina - avatar
3 Answers
+ 4
Post increment firstly do operation and secondly increment variable. Then alert(a++) is the same as alert(a) a++.
24th Apr 2018, 7:13 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
+ 2
Here. Go to the js tab and read the comments. â˜ș https://code.sololearn.com/W2o1rIA5I7qQ/?ref=app
24th Apr 2018, 7:53 PM
cyk
cyk - avatar