A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/right-shift-assignment-operator-in-javascript/ below:

Right Shift Assignment(>>=) Operator in JavaScript

Right Shift Assignment(>>=) Operator in JavaScript

Last Updated : 23 Jul, 2025

The Right Shift Assignment Operator is represented by ">>=". This operator shifts the first operand to the right and assigns the result to the variable. It can also be explained as shifting the first operand to the right in a specified amount of bits which is the second operand integer and then assigning the result to the first operand. 

Syntax:

a >>= b
Or
a = a >> b

Where -

 

Example 1: In this example, we will see the implementation of the right shift assignment.

JavaScript
let x = 7; // 00000000000000000000000000000111

x >>= 2;   // 00000000000000000000000000000001

console.log(x);

Example 2: In this example, we will see assigning the right shift operator to the variable.

JavaScript
let a = 10; // 00000000000000000000000000001010
let b = 2;  // 00000000000000000000000000000010
a = a >> b; // 00000000000000000000000000000010

console.log(a);

We have a complete list of Javascript Assignment Operators, Please check this article Javascript Assignment Operator.

Supported Browser:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4