The Prefix Operator Group
The Pre Increment Operator ( ++ )
The Pre Decrement Operator ( -- )



Navigation Aids -- This Page        Navigation Aids -- This Topic        Navigation Aids -- This Site








Review of Terms Related to This Topic





The Purpose for this Page

This page will show the basic rules for the JavaScript prefix operator group. Some special situation cases are explained. And finally, some scripting examples are provided with comments.





The Basics of Prefix Operators





Special Situations





Some Script Examples


Expression Giving Comment
var x = 4;
alert(++x);
5 Pre-Increment
prefix operations adds one to the value before its value is used
var x = 4;
y = ++x;
y = 5 Pre-Increment
variable y gets value of x after the post-increment;
both x and y will equal 5
var x = 4;
alert(--x);
3 Pre-Decrement
prefix decrement subtracts one from the value before its value is used
var x = 4;
y = --x;
y = 3 Pre-Decrement
variable y gets value of x after the pre-decrement


Top            

Rx4AJAX        About Us | Topic Index | Contact Us | Privacy Policy | 2008 This Site Built By PPThompson