Jump to content
m.s_shohan

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.

 

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

Share this post


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

Share this post


Link to post
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.

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...