# Bitwise operator

4 posts Page 1 of 1

## Bitwise operator

by Nilutpal Boruah » Wed Dec 25, 2013 6:38 am

What are bitwise operators? What are their uses?

## Re: Bitwise operator

by XainPro » Wed Dec 25, 2013 10:17 pm

Bitwise operators perform an operation on the bitwise (0,1) representation of their arguments, rather than as decimal, hexadecimal, or octal numbers. For example, the decimal number eight has a binary representation of 1000. Bitwise operators do their operations on such binary representation (for example 1000) but they return standard JavaScript numerical values.

Here is a list of JavaScript's bitwise operators.
Operator Usage Description
Bitwise AND a & b Returns a one in each bit position if bits of both left and right operands are ones.
Bitwise OR a | b Returns a one in each bit if bits of either left or right operand is one.
Bitwise XOR a ^ b Returns a one in a bit position if bits of one but not both left and right operand are one.
Bitwise NOT ~ a Flips the bits of its operand.
Left shift a << b Shifts a in binary representation b bits to the left, shifting in zeros from the right.

## Re: Bitwise operator

by Nilutpal Boruah » Thu Dec 26, 2013 4:59 am

Thanks.. I was a li'l bit confused about these.. In other websites, I've read that the bitwise operators generally are not used in the creation of a dynamic website. Is this true? If it is so can I skip this topic?

## Re: Bitwise operator

by XainPro » Tue Dec 31, 2013 5:39 pm

i do not know about others but you can not skip these 2 operators these are used more then you can imagine

Bitwise AND a & b Returns a one in each bit position if bits of both left and right operands are ones.
Bitwise OR a | b Returns a one in each bit if bits of either left or right operand is one.