Signed Right Shift
The operator of signed right shift is >>. It shifts all bits in a number to the right while preserving the sign. A signed right shift is the opposite of a left shift.
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
var oldValue = 64; //equal to binary 1000000
var newValue = oldValue >> 5; //equal to binary 10 which is decimal 2
document.writeln(newValue);//2
</script>
</head>
<body>
</body>
</html>
Home
JavaScript Book
Language Basics
JavaScript Book
Language Basics
Operators:
- JavaScript Operators
- Increment/Decrement Operators
- Increment/Decrement Operators for String, Boolean, Floating-point and Object
- Unary Plus and Minus
- Bitwise Not operator
- Bitwise AND
- Bitwise OR
- Bitwise XOR
- Left Shift
- Signed Right Shift
- Unsigned Right Shift
- Logical NOT
- Logical AND
- Logical OR
- Multiply
- Divide
- Modulus
- Add
- Subtract
- Relational Operators
- Equal and Not Equal
- Identically Equal and Not Identically Equal
- Conditional Operator
- Assignment Operators
- Comma Operator