JavaScript Increment or Decrement Operator
JavaScript Operators Definition:
• An operator that performs some operation on single or multiple operands and produces a result is called Operators.
• An Operators are symbols or keyword that enable JavaScript to perform some sort of actions.
JavaScript Increment/Decrement Operator
• The increment/decrement operators are used to increment/decrement a variable's values of an operand
Operator | Name | Effect |
---|---|---|
++x |
Pre-increment | Increments x by one, then returns x |
x++ |
Post-increment | Returns x, then increments x by one |
--x |
Pre-decrement | Decrements x by one, then returns x |
x-- |
Post-decrement | Returns x, then decrements x by one |
Example:
Result:
11 11 10 11 9 9 10 9
Read Also:
- JS Arithmetic Operators
- JS Comparison Operators
- JS Logical Operators
- JS Assignment Oerators
- JS Conditional Operators (or) ternary Operator
- JS Bitwise Operator
- JS Decrement Operator