Home arrow JavaScript arrow Page 4 - The Power of Javascript: Operators continued
JAVASCRIPT

The Power of Javascript: Operators continued


In the last article we talked about some of the unary and binary operators available in Javascript, namely the arithmetic operators, the comparison operators and the increment/decrement operators. In this article we continue our discussion of the Javascript operators; we will discuss how computers represent data, and bitwise operators.

Author Info:
By: Michael Youssef
Rating: 5 stars5 stars5 stars5 stars5 stars / 8
July 26, 2005
TABLE OF CONTENTS:
  1. · The Power of Javascript: Operators continued
  2. · Bitwise Operators
  3. · The Bitwise Operators Example
  4. · Assignment Operators
  5. · Assignment Operators Example

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
The Power of Javascript: Operators continued - Assignment Operators
(Page 4 of 5 )

We have been using the assignment operator (=) since the first article in the series. Assignment operators are binary operators that assign the value of their right operands to the variable on their left operands. The assignment operator (=) can be combined with the arithmetic operators or with the bitwise operators to offer you a way to perform an operation, then an assignment, as a shortcut statement. Let's take a look at those assignment operators.

Operator

Operator Explanation

+=The statement x += 1 is the same as x = x + 1; It's like saying assign the value 1 to the value of x.
-=x -= 1 is the same as x = x - 1;
*=x *= 2 is the same as x = x * 2;
/=x /= 2 is the same as x = x / 2;
%=x %= 2 is the same as x = x % 2;
&=x &= 2 is the same as x = x & 2;
|=x |= 2 is the same as x = x | 2;
^=x ^= 2 is the same as x = x ^ 2;
>>=x >>= 2 is the same as x = x >> 2;
<<=x <<= 2 is the same as x = x << 2;


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials