A lot of people do not know there is a difference existing between these two incremental methods popular in most programming languages.
Here I would simplify it and show you the difference.
The i++
statement is different from the ++i
in that i++
returnns the value of i
before incrementing; while the latter, ++i
, as it should occur to you, since the ++
sign comes before i
—increments first before returning i
.
let input = "incremental methods";
let i = 0;
let char = input.charAt(i++); // here i = 0