freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/increment-a-number-with-jav.../index.md

12 lines
443 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Increment a Number with JavaScript
---
## Increment a Number with JavaScript
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
You can easily increment (add one) to a number variable by using the '++' increment operator. For example:
var a = 6;
a++; // Now, 'a' is equal to 7 -- post-fixing
++a; // Now, 'a' is equal to 8 -- pre-fixing