Is there a way to increment or decrement by a number more than one

In this exercise, we learnt to increment or decrement by 1. Is there a way to increment or decrement by any number more than 1?

https://www.codecademy.com/paths/web-development/tracks/getting-started-with-javascript/modules/learn-javascript-introduction/lessons/variables/exercises/increment-decrement

Hello @noblekc.
You can use the += for incrementing or -= for decrementing:

let a = 7;
a -= 4;//a equals 3
a += 4;//a equals 11

I hope this helps!

3 Likes

Very nice. A very helpful reminder, Thanks.

1 Like