Home | | Internet & World Wide Web HOW TO PROGRAM | | Internet Programming | | Web Programming | Assignment Operators - JavaScript(JS)

Chapter: Internet & World Wide Web HOW TO PROGRAM - The Ajax Client - JavaScript: Control Statements I

| Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail |

Assignment Operators - JavaScript(JS)

JavaScript provides several assignment operators (called compound assignment operators) for abbreviating assignment expressions.

Assignment Operators

 

JavaScript provides several assignment operators (called compound assignment operators) for abbreviating assignment expressions. For example, the statement

 

c = c + 3;

 

can be abbreviated with the addition assignment operator+=, as

 

c += 3;

The += operator adds the value of the expression on the right of the operator to the value of the variable on the left of the operator and stores the result in the variable on the left of the operator. Any statement of the form

 

variable  = variable  operator  expression;

 

where operator is one of the binary operators +-*/ or % (or others we will discuss later in the text), can be written in the form

 

variable  operator = expression;

 

Thus, the assignment c += 3 adds 3 to c. Figure 7.12 shows the arithmetic assignment op-erators, sample expressions using these operators and explanations of the meaning of the operators.




Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.