Postfix AND Prefix increment and decrement in Javascript
Postfix AND Prefix increment and decrement in Javascript is the today topic of discussion in this tutorial.Algorithm of Postfix AND Prefix increment and decrement in Javascript
START Step 1 → Take variable Q,W,E,T Step 2 → PRE INCREMENT Q Step 5 → POST INCREMENT W Step 6 → PRE DECREMENT E Step 7 → POST INCREMENT T Step 8→ SHOW THE RESULT STOPProgram of Postfix AND Prefix increment and decrement in Javascript
Lets see a basic program of Program of Postfix AND Prefix increment and decrement in Javascript.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<html> <head> <title> javascript prefix and Postfix </title> </head> <body> <script> var Q = 10, W = 20, E = 5, T= 4; document.write("<b>PREFIX INCREMENT </b>"); document.write("<br \> Value of Q: " + Q); document.write("<br \> Value of Q : "+ (++Q)); document.write("<br \> <b>----POSTFIX INCREMENT</b>"); document.write("<br \> Value of W : "+ W); document.write("<br \> Value of W : "+ W++); document.write("<br \> <b>----PREFIX DECREMENT </b>"); document.write("<br \> Value of E : "+ E); document.write("<br \> Value of E : "+ --E); document.write("<br \> <b>----POST DECREMENT</b>"); document.write("<br \> Value of T : "+ T); document.write("<br \> Value of T : "+ T--); </script> </body> </html> |