CalculatorsLesson 156Free preview
Bitwise Calculator
This lesson is part of Web Developer Tools · All levels
Summary
Bitwise Calculator implements logic operations per bit such as AND, OR, XOR, NOT, as well as left and right shifts on integers. This operation is used to set flags, masks, access permissions, and small-scale binary data. The calculator usually displays the operand in binaries so that each bit that changes is clearly visible.
Key points
- AND (&) only makes 1 if both bits are equal to 1.
- OR (originally) yields 1 if one bit is worth 1
- XOR (^) yields 1 if the two bits are different
- The left shift (<<) shifts the bit and is equal to multiplying the rank by 2
- NOT (~) flips the bit and in JavaScript works on 32-bit signed
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.