2 ms·
Because you should write what you mean, not just assume the compiler will convert what you wrote into what you mean. i++ means var temp = i; i =
by tokyodude 8y ago
Because you should write what you mean, not just assume the compiler will convert what you wrote into what you mean.
i++
means
var temp = i;
i = i + 1;
return temp;
where as
++i
means
i = i + 1
return i;
So if you actually mean to create a temp then use i++ , if you don't use ++i
See example of actually implementing them
https://stackoverflow.com/a/3846374 https://stackoverflow.com/a/3846374