मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता ११

Difference between the increment and Decrement operator.

Advertisements
Advertisements

प्रश्न

Difference between the increment and Decrement operator.

फरक स्पष्ट करा
Advertisements

उत्तर

  • Increment Operator (++):

  1. The ++ operator increments its single operand.
  2. The operator converts its operand to a number, adds 1 to that number and assigns the incremented value back into the variable.
  3.  When ++ is used before the operand, where it is known as the pre-increment operator. When used after the operand, where it is known as the post-increment operator.
    • Eg: var m = 1, n= ++m;
    • var m = 1, n = m++;
  • Decrement Operator (–):

  1. The – – operator decrement its single operand.
  2. It converts the value of the operand to a number subtracts 1 and assigns the decremented value back to the operand.
  3. When ++ is used before the operand, it decrements the value. When used after the operand, it decrements the operand but returns the undecremented value.
    • Eg: var m = 2, n = -m;
    • var m = 2, n= m –;
shaalaa.com
Javascript Operators and Expressions
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 14: Introduction to Javascript - Evaluation [पृष्ठ ३१४]

APPEARS IN

सामाचीर कलवी Computer Applications [English] Class 11 TN Board
पाठ 14 Introduction to Javascript
Evaluation | Q 6. | पृष्ठ ३१४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×