Skip to main content Accessibility Feedback

Numbers

Increment & Decrement

You can increment numbers up one in value with the ++ operator, and decrement them down one in value using the -- operator.

let num = 1;

// Increment
// logs 2
num++;
console.log(num);

// Decrement
// logs 1
num--;
console.log(num);

Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.


Find this useful? You can support my work by purchasing an annual membership.