m.s_shohan Posted September 8, 2016 Share Posted September 8, 2016 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. Link to comment Share on other sites More sharing options...
davej Posted September 8, 2016 Share Posted September 8, 2016 Do you understand what binary numbers are? https://en.wikipedia.org/wiki/Binary_number Obviously... 1 OR 1 = 1 1 AND 1 = 1 1 OR 0 = 1 1 AND 0 = 0 etc... https://en.wikipedia.org/wiki/Bitwise_operation 1 Link to comment Share on other sites More sharing options...
Ingolme Posted September 8, 2016 Share Posted September 8, 2016 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 Link to comment Share on other sites More sharing options...
justsomeguy Posted September 8, 2016 Share Posted September 8, 2016 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 Link to comment Share on other sites More sharing options...
m.s_shohan Posted September 11, 2016 Author Share Posted September 11, 2016 Thank you so much davej,Ingolme and justsomeguy. Because of you guys, I got the point......Thank you so much............ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now