H I O X INDIA
Javascript Tutorial
Google
Web hscripts.com
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Java-Script Tutorial
Introduction
Variables
Operators
Statements
Loops
Functions
Objects
Arrays
Browser Objects
Form DOM
Ask Your Doubts
Feedback





Assignment Operators


Topic

How to assign a incremental value to a variable in javascript?
Different assaignment operators and their purpose?



Explanation

Assignment Operators:
Assignment Operators are use to assign a value to a variable.
Operator Syntax Description Example
= used to assign a value on the right side to the variable of the left side of the operator. b = 3;
+= it adds the value on the right to the previous value of the variable on the left and assign the new value to the variable. b = 3;
b += 4;
// Now b will become 7
-= it subtracts the value on the right to the previous value of the variable on the left and assign the new value to the variable. b = 4;
b -= 2;
// Now b will become 2
*= it multiplies the operand on the right to the previous value of the variable on the left and assaigns the new value to the variable. b = 4;
b *= 2;
// Now b will become 8
/= it divides the operand on the right to the previous value of the variable on the left and assaigns the new value to the variable. b = 6;
b /= 2;
// Now b will become 3
<<= The operand on the left is shifted left by the value on the right. -
<<= A signed right shifted is performed on the left operand by the value on the right. -



        Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

others

privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Other Links