Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.03 KB

cl3e4gck60csux2nv7oow9zj7.md

File metadata and controls

33 lines (27 loc) · 1.03 KB

Increment and Decrement Operation in JavaScript

Hello Everyone, My name is Surya L. This blog will teach you all about the Increment(++) and Decrement Operation(--) in JavaScript.

Increment a Number with JavaScript

You can easily increment or add one to a variable with the ++ operator. For example

i++;
//is the equivalent of

i = i + 1;
//Note: The entire line becomes i++;, eliminating the need for the equal sign.

let myVar = 87;
myVar++;//You can easily increment or add one to a variable with the ++ operator.

Decrement a Number with JavaScript

You can easily Decrement or Subtract one to a variable with the -- operator. For example

i--;
//is the equivalent of

i = i -1;
//Note: The entire line becomes i--;, eliminating the need for the equal sign.

let myVar = 11;
myVar--;//You can decrement or decrease a value of myVar by one with the -- operator.

**Credits: I learned this topics in FreeCodeCamp which I explained in minified version ** Thanks for reading the blog. Do let me know what you think about it.