2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Increment a Number with JavaScript
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Increment a Number with JavaScript
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
You can easily increment (add one) to a number variable by using the '++' increment operator. For example:
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
```javascript
|
|
|
|
var a = 6;
|
|
|
|
a++; // Now, 'a' is equal to 7 -- post-fixing
|
|
|
|
++a; // Now, 'a' is equal to 8 -- pre-fixing
|
|
|
|
```
|