I didn't understand these bitwise operators. Plz help.....

Recommended Posts

Hi, I am a beginner web designer and developer. Now I am learning javascript. But while learning I didn't understand the bitwise operators and how they works. In the below image how X converts to decimal? Please help as many experienced and professional web developers are present here. Thank you.

Share on other sites

Bitwise operators do operations with the bits in binary numbers. All numbers have a binary representation.

The AND operator only returns 1 only if both of the input bits are 1.

The OR operator returns 1 if any of the input bits are 1.

The NOT operator returns the opposite value of the input bit.

The XOR operator returns 1 only if the two input bits are different from each other.

The left shift and right shift operators move everything to the left or to the right by the specified number of positions.

In the number 00011000, shifting left by 3 results in 11000000 while shifting right by 3 results in 00000011

• 1
Share on other sites

The decimal result in the page you linked to isn't the column to pay attention to, decimal doesn't really mean much when you're dealing with binary operations. The binary result is the important one.

• 1
Share on other sites

Thank you so much davej,Ingolme and justsomeguy. Because of you guys, I got the point......Thank you so much............

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account