increment operator

ECMA Specification Safari: Increment (and Decrement) Operators

Recently, I’ve started reading through the ECMA Script (JavaScript) specification to get a more in depth understanding of the language I seem to be using every day. There are some interesting things I am coming across. Today’s interesting thing is increment and decrement operators. There are two ways of incrementing a variable (decrementing the variable works in the same way): putting the increment operator before or after the variable. var prefixIncrementVariable = "4" var postfixIncrementVariable = "4" ++ prefixIncrementVariable // returns 5 postfixIncrementVariable ++ // returns 4 What both operators do is convert the…

Keep reading