-5

I've seen various people use stuff like i++, and I know that is also used in a for-loop.

But what exactly does ++ do to a variable? I cannot seem to find any documentation on what it does.

Mogsdad
  • 40,814
  • 19
  • 140
  • 246
Chizbe Joe
  • 35
  • 1
  • 8

2 Answers2

4

The ++ notation is the increment operators.

i++ is the same thing of

i = i +1

here you can see the completly list of this operators: http://www.w3schools.com/js/js_operators.asp

pchlsn
  • 41
  • 3
3

It's to increment.

var i = 1;
i++; // i becomes 2.
Josh
  • 1,345
  • 12
  • 28