Understanding Incrementing
Posted
by Chad
on Stack Overflow
See other posts from Stack Overflow
or by Chad
Published on 2009-12-28T07:27:47Z
Indexed on
2010/04/10
18:53 UTC
Read the original article
Hit count: 196
For example this:
var a = 123;
var b = a++;
now a
contains 124
and b
contains 123
I understand that b is taking the value of a and then a is being incremented. However, I don't understand why this is so. The principal reason for why the creators of JavaScript would want this. Is this really more useful than doing it the PHP way? What is the advantage to this other than confusing newbies?
© Stack Overflow or respective owner