In JavaScript “>>>=” is known as the unsigned right shift assignment bitwise operator. This operator is used to move a particular amount of bits to the right and returns a number that is assigned to a variable.
Syntax:
a >>>= b
Meaning: a = a >>> b
Return value: It returns the number after shifting of bits.
Example 1: This example shows the basic use of the Javascript Unsigned Right Shift Assignment Operator.
Javascript
<script>
let a = 16
let b = 2
console.log(`${a}>>>=${b} is ${a >>>= b}`)
</script>
|
Output:
16>>>=2 is 4
Example 2: Using a variable to store the return value by >>> operator.
Javascript
<script>
let a = 6
let b = 3
c = a >>> b
console.log(`${a}>>>${b} is ${c}`)
console.log(`${15}>>>${2} is ${15 >>> 2}`)
console.log(`${10}>>>${1} is ${10 >>> 1}`)
</script>
|
Output:
6>>>3 is 0
15>>>2 is 3
10>>>1 is 5