As the name says, the increment operator increases the value of a variable by 1. There are two types of increment operators: pre-increment and post-increment.

Pre-increment

The pre-increment operator increases the value of a variable by 1 and then returns the value. For example:

let x = 1;
console.log(++x); // 2
console.log(x); // 2

Post-increment

The post-increment operator returns the value of a variable and then increases the value by 1. For example:

let x = 1;
console.log(x++); // 1
console.log(x); // 2