Course Content
Introduction to JavaScript
4. Conditional Statements
Introduction to JavaScript
Increment and Decrement
Increment and Decrement are operations used to increase or decrease a variable's value by 1
.
Increment
The increment operation is performed using the ++
operator:
Note
The expression
a++
is equivalent toa = a + 1
ora += 1
.
Decrement
The decrement operation is performed using the --
operator:
Note
The expression
a--
is equivalent toa = a - 1
ora -= 1
.
Increment and decrement operations are frequently used in loops, which we will discuss in more detail later.
Everything was clear?
Course Content
Introduction to JavaScript
4. Conditional Statements
Introduction to JavaScript
Increment and Decrement
Increment and Decrement are operations used to increase or decrease a variable's value by 1
.
Increment
The increment operation is performed using the ++
operator:
Note
The expression
a++
is equivalent toa = a + 1
ora += 1
.
Decrement
The decrement operation is performed using the --
operator:
Note
The expression
a--
is equivalent toa = a - 1
ora -= 1
.
Increment and decrement operations are frequently used in loops, which we will discuss in more detail later.
Everything was clear?