TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
>>>= (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
Technical Mechanics
When the JavaScript engine evaluatesx >>>= y, it performs the following sequence of operations:
- Numeric Evaluation (
ToNumeric): Both operands are evaluated to numeric values. If the resulting type of either operand is aBigInt, the engine immediately throws aTypeError. The>>>and>>>=operators are the only bitwise operators in JavaScript that explicitly do not supportBigInt. - 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).
- The evaluated left operand (
- 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 between0and31inclusive (which is functionally equivalent to a bitwise AND mask ofy & 0x1F). - Bitwise Shift: The binary representation of
xis shifted to the right by the calculated shift count. - 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. - 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.
Negative Integer Shift
Because negative numbers are represented using two’s complement and have a leading1 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.
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.
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.
Master JavaScript with Deep Grasping Methodology!Learn More





