Friday, 10 December 2010

Assignment Operators

JavaScript Assignment Operators

Assignment operators are used to assign values to JavaScript variables.

Given that x=20 and y=10

Operator Example Same As Result
= x=y  
x=10
+= x+=y x=x+y x=30
-= x-=y x=x-y x=10
*= x*=y x=x*y x=200
/= x/=y x=x/y x=2
%= x%=y x=x%y x=0

0 comments: