Microsoft JScript
>> Operator |
Language Reference
Version 1 |

Used to shift the bits of an expression to the right, maintaining sign.

result=expression1 >> expression2The

>>operator syntax has these parts:

PartDescriptionresultAny variable. expression1Any expression. expression2Any expression.

The >> operator shifts the bits of

expression1right by the number of bits specified inexpression2. The sign bit ofexpression1is used to fill the digits from the left. Digits shifted off the right are discarded. For example, after the following code is evaluated,temphas a value of -4: 14 (11110010 in binary) shifted right two bits equals -4 (11111100 in binary).

var temp temp = -14 >> 2

For information on when a run-time error is generated by the

>>operator, see the Operator Behavior table.

Comments