<script type="text/javaScript"> <!-- var i = 0; var result = 0
document.write("If i = 0, "); document.write("i returns the value of i"); document.write(" after incrementing : ");
// Increment prefix result = ++i;
document.write(result); i = 0; document.write("<br>i++ returns the value of i"); document.write(" before incrementing : ");
// Increment suffix result = i++; document.write(result); i = 0; document.write("<br>--i returns the value of i"); document.write(" after decrementing : ");
// Decrement prefix result = --i; document.write(result)
i = 0; document.write("<br>i-- returns the value of i"); document.write(" before decrementing : "); // Decrement suffix result = i--;
document.write(result); // --> </script>
</body> </html>
Related Scripts with Example Source Code in same category :