Jump to content

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


m.s_shohan
 Share

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.

 

post-201838-0-11884200-1473325487_thumb.png

Link to comment
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

  • Like 1
Link to comment
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...