Home  >  Article  >  Web Front-end  >  JavaScript unsigned right shift operator_Basic knowledge

JavaScript unsigned right shift operator_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 18:53:541381browse

Usage example

result = expression1 >>> expression2

where result is any variable.
expression1 is any expression.
expression2 is any expression.

Explanation of unsigned right shift operator in JavaScript
>>> operator shifts each bit of expression1 to the right by the number of digits specified by expression2. After the right shift, the vacated bits on the left are filled with zeros. Bits shifted out to the right are discarded. For example:
var temp
temp = -14 >>> 2

The value of variable temp is -14 (i.e. binary 11111111 11111111 11111111 11110010), which is equal to 1073741820 after shifting two places to the right ( That is, binary 00111111 11111111 11111111 11111100).

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn