InterviewHubPRO
Section Overview
Q192

Question 192 of 521

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

37%
JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

What are the bitwise operators available in javascript

Below are the list of bitwise logical operators used in JavaScript

  1. Bitwise AND ( & )
  2. Bitwise OR ( | )
  3. Bitwise XOR ( ^ )
  4. Bitwise NOT ( ~ )
  5. Left Shift ( << )
  6. Sign Propagating Right Shift ( >> )
  7. Zero fill Right Shift ( >>> )

Practical Code Example

javascript
// Bitwise Operators manipulate 32-bit binary representations:
const READ = 1;    // 0001
const WRITE = 2;   // 0010
const EXECUTE = 4; // 0100

let permission = READ | WRITE; // 0011 (Bitwise OR: combine flags)
console.log((permission & READ) !== 0);    // true  (Bitwise AND: test flag)
console.log((permission & EXECUTE) !== 0); // false