Working with the Increment Operator : Operator « Language Basics « JavaScript DHTML






Working with the Increment Operator

  
<HTML>
<BODY>
<H1>
<SCRIPT> 
var Inc = 1; 
document.write("Starting value of " + Inc + "<BR>"); 
document.write("IncPreFix " + ++Inc + "<BR>"); 
document.write("IncPostFix " + Inc++ + "<BR>"); 
document.write("Ending value of " + Inc); 
</script>
</H1>
</BODY>
</HTML>

           
         
    
  








Related examples in the same category

1.Using the Equal Operator
2.Examples of Increment and Decrement Operators
3.Operators and Expressions:Operator Summary Table
4.Add two integer variables together
5.Subtract one integer variable from another integer variable
6.Multiply two integer variables together
7.Modular operation (remainder in division)
8.Prefix plus
9.Prefix subtraction
10.Postfix adding
11.Postfix subtraction
12.Postfix operator for integer
13.Prefix operator for integer
14.JavaScript compound plus assignment
15.JavaScript compound subtraction assignment
16.JavaScript compound multiply assignment
17.JavaScript compound divide assignment
18.Ternary operator
19.Tenary operator