Increment & Decrement Operators - Part 2

Notes:

JavaScript Increment and Decrement Operators:

Increment and Decrement Operators: (are unary operators)
are used to increment or decrement a variable value by 1.

++ : Increment Operator:
Increment Operator is used to increment a variable value by 1

Two types of increment:
Post Increment : variableName ++
Pre Increment : ++ variableName

-- : Decrement Operator:
Decrement Operator is used to decrement a variable value by 1

Two types of decrement:
Post Decrement: variableName --
Pre Decrement : -- variableName

Example code2:
var a=10;
document.write("a=",a); //a=10
document.write("a=",a++); //a=10
document.write("a=",a); //a=11

var a=10;
document.write("a=",a); //a=10
document.write("a=",++a); //a=11
document.write("a=",a); //a=11

var a=10;
document.write("a=",a); //a=10
document.write("a=",a--); //a=10
document.write("a=",a); //a=9

var a=10;
document.write("a=",a); //a=10
document.write("a=",--a); //a=9
document.write("a=",a); //a=9

Interview Questions: