Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Unsigned right shift assignment (>>>=)

The >>>= operator shifts a value’s 32-bit representation to the right, fills vacated bits with zeros, and stores the result in the left operand. Unlike >>=, it does not preserve the sign bit. It does not support BigInt.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

target >>>= shiftCount

target >>>= shiftCount combines the >>> shift with assignment. For a simple variable, it acts like target = target >>> shiftCount, but the assignment target is evaluated only once. The expression returns the computed shift result, which can differ from the value stored after conversion. For example, applying >>>= 0 to an Int8Array element containing -1 returns 4294967295, but the element still contains -1 after conversion on write. The target must be writable for the store to succeed. In non-strict code, assignment to a non-writable data property can fail silently while the expression still returns the computed shift result. Assigning to a variable declared with const throws TypeError.

The operation converts the operands numerically, then applies ToUint32 to both Number values. The shift count is the converted right operand modulo 32, so 34 means a shift of 2 bits. The result is a Number from 0 through 4294967295, not a separate unsigned integer type.

Unlike >>=, >>>= inserts zeros rather than copying the sign bit. A negative input can therefore produce a large positive number. Conversion to 32 bits can discard fractional parts and higher bits; this is not general-purpose division by a power of two. Even a shift of 0 performs the conversion.

BigInt does not support this operator: both two BigInt operands and a mixture of BigInt and Number cause TypeError. The example demonstrates the assignment result, the difference from >>, and reduction of the shift count modulo 32.

Examples

let value = -8;
const result = (value >>>= 1);
console.log(value);
console.log(result);
console.log(-8 >> 1);

let wrapped = 16;
wrapped >>>= 34;
console.log(wrapped);

Result

2147483644
2147483644
-4
4

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources