The job title is as follows:
--------------------------------------------------
Bit operators are not very familiar with this problem, just fill it up.
Decimal to Binary method: Divide the decimal number by 2 to take the first remainder, and then the quotient is divided by 2 continuously, taking the second and third ... Remainder until the quotient is 0 o'clock, then the first, second ... From right to left, high 0.
Binary to decimal method: Starting from the rightmost number of the binary number, from left to right, each digit is multiplied by 2 of the 0, 2 1, 2 2, and then the result is added, that is, the decimal number.
Therefore, this problem decimal 22 into the binary process: the remainder of the 22/2=11 is 0;11/2=5 remainder is the 1;5/2=2 remainder for the 1;2/2=1 remainder is the 0;1/2=0 remainder of 1. The binary of decimal 22 is 10110.
Decimal 3 to Binary procedure: 3/2=1 remainder is 1;1/2=0 remainder is 1. Decimal 3 is converted to binary 11.
In addition, the & operation, corresponding to the number of digits compared, there is a 0 is 0, two at the same time 1 to get 1.
So 10110&00011, the result of the operation is 00010, this is binary. The conversion to decimal is: 1*2 1 times the square +0 Times 2 of the 0 square = 2.
The six--js bit operator exercises in the front-end learning notes