Answers for "++i vs i++"

0

++i vs i++

// ++i will increment the value of i, and then return the incremented value.

 i = 1;
 j = ++i;
 (i is 2, j is 2)

// i++ will increment the value of i, but return the original value that i held before being incremented.

 i = 1;
 j = i++;
 (i is 2, j is 1)
Posted by: Guest on July-06-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language