Can someone explain me about Increment & Decrement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain me about Increment & Decrement?

var++ / ++var / var--/ --var

17th Jun 2021, 12:45 PM
Shin Htoo Wai
Shin Htoo Wai - avatar
3 Answers
+ 4
Pre increment and pre decrement will always solve first the post increment or decrement Suppose var =3; var++/++var here values will be calculated like this 3/++4 highest priority of divide than why value will be increase but var++ will increase after solving this expression here values incrementing two times watch on YouTube you will understood much better. Same for decrement
17th Jun 2021, 1:16 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Thank you
17th Jun 2021, 3:58 PM
Shin Htoo Wai
Shin Htoo Wai - avatar
+ 1
The JavaScript Increment and Decrement Operators useful to increase or decrease the value by 1. For instance, Incremental operator ++ used to increase the existing variable value by 1 (x = x + 1). The decrement operator – – is used to decrease or subtract the existing value by 1 (x = x – 1).
18th Jun 2021, 5:22 AM
Rohit Singh
Rohit Singh - avatar