> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript Unsigned Right Shift Assignment

The `>>>=` (unsigned right shift assignment) operator shifts the binary representation of the left operand to the right by the number of bits specified by the right operand, fills the vacated most significant bits with zeroes, and assigns the resulting 32-bit unsigned integer back to the left operand.

## Syntax

```javascript theme={"dark"}
x >>>= y
```

This is the compound assignment equivalent of the logical right shift operation:

```javascript theme={"dark"}
x = x >>> y
```

## Technical Mechanics

When the JavaScript engine evaluates `x >>>= y`, it performs the following sequence of operations:

1. **Numeric Evaluation (`ToNumeric`):** Both operands are evaluated to numeric values. If the resulting type of either operand is a `BigInt`, the engine immediately throws a `TypeError`. The `>>>` and `>>>=` operators are the only bitwise operators in JavaScript that explicitly do not support `BigInt`.
2. **Operand Coercion:**
   * The evaluated left operand (`x`) is coerced into a 32-bit unsigned integer (`ToUint32`).
   * The evaluated right operand (`y`) is coerced into a 32-bit unsigned integer (`ToUint32`).
3. **Shift Count Calculation:** The shift amount is determined by applying a mathematical modulo 32 to the coerced right operand (`ℝ(y) modulo 32`). Because the right operand has already been coerced to a 32-bit unsigned integer, it is strictly non-negative. This operation ensures the resulting shift count is always an integer between `0` and `31` inclusive (which is functionally equivalent to a bitwise AND mask of `y & 0x1F`).
4. **Bitwise Shift:** The binary representation of `x` is shifted to the right by the calculated shift count.
5. **Zero-Fill:** The bits shifted off to the right are discarded. The vacated bits on the left (the most significant bits) are strictly filled with `0`. This differs from the sign-propagating right shift (`>>=`), which fills vacated bits with a copy of the original sign bit.
6. **Assignment:** The resulting 32-bit unsigned integer is assigned back to the variable `x`.

## Behavior Examples

### Positive Integer Shift

When shifting positive integers, `>>>=` behaves identically to `>>=`, except the result is explicitly typed as an unsigned 32-bit integer.

```javascript theme={"dark"}
let a = 20; 
// 20 in 32-bit binary: 00000000000000000000000000010100

a >>>= 2; 
// Shifts right by 2, fills left with 0s
// Resulting binary:    00000000000000000000000000000101

console.log(a); // 5
```

### Negative Integer Shift

Because negative numbers are represented using two's complement and have a leading `1` as the sign bit, applying `>>>=` to a negative number results in a drastic value change. The zero-fill operation strips the negative sign, converting the underlying bit sequence into a large positive unsigned integer.

```javascript theme={"dark"}
let b = -9;
// -9 in 32-bit binary: 11111111111111111111111111110111

b >>>= 2;
// Shifts right by 2, fills left with 0s
// Resulting binary:    00111111111111111111111111111101

console.log(b); // 1073741821
```

### BigInt Exception

Attempting to use `>>>=` with a `BigInt` operand will throw a `TypeError`. Unsigned right shifts are incompatible with `BigInt` because `BigInt` represents an arbitrary-precision integer and does not have a fixed bit-width or a defined "most significant bit" to zero-fill.

```javascript theme={"dark"}
let c = 10n;

c >>>= 2n; 
// TypeError: BigInts have no unsigned right shift, use >> instead
```

### Non-Integer Coercion

If the left operand evaluates to a non-numeric type that cannot be parsed into a valid number, `ToNumeric` resolves it to `NaN`. During the `ToUint32` conversion phase, `NaN` (as well as `null` and `undefined`) is coerced to `0`.

```javascript theme={"dark"}
let d = "Hello"; // ToNumeric yields NaN, ToUint32 yields 0
d >>>= 2;
console.log(d); // 0

let e = null; // ToNumeric yields 0, ToUint32 yields 0
e >>>= 5;
console.log(e); // 0
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor JavaScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
