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 or zero-fill right shift) operator shifts the binary representation of the first operand to the right by the number of bits specified by the second operand. It discards bits shifted off the right and fills the newly vacated bits on the left with zeroes (0). Because it does not preserve the sign bit, the operation always evaluates to a non-negative 32-bit unsigned integer.
Technical Mechanics
- Type Coercion: TypeScript (inheriting from JavaScript’s underlying ECMAScript specification) internally converts
operand1into a 32-bit unsigned integer (ToUint32). - Shift Masking:
operand2is converted to an unsigned 32-bit integer and masked using a bitwise AND (operand2 & 0x1F). This restricts the actual shift amount to a value between0and31bits. - Zero-filling: As bits are shifted to the right, the leftmost bits are populated with
0. This fundamentally alters negative numbers, as their leading1(the sign bit in two’s complement representation) is replaced by0. - Return Type: The result is always returned as a 32-bit unsigned integer, typed as
numberin TypeScript. - BigInt Incompatibility:
>>>is the only bitwise operator in TypeScript/JavaScript that does not supportBigInt. BecauseBigIntrepresents arbitrary-precision integers without a fixed bit-width, an unsigned right shift is mathematically invalid. Attempting to use>>>withbigintoperands throws a compilation error.
Behavior Visualization
Positive Integer Shift: When shifting positive numbers,>>> yields the exact same result as the sign-propagating right shift (>>) because the sign bit is already 0.
1s are replaced with 0s, resulting in a large positive integer.
ToUint32 coercion before the shift occurs.
0 bits forces any value into a 32-bit unsigned integer without altering its bit sequence.
>>> to bigint types results in a strict type error.
Master TypeScript with Deep Grasping Methodology!Learn More





