Java Reference
In-Depth Information
Bitwise shift operators
These work by converting values in v1 to 32‐bit binary numbers and then moving the bits in the
number to the left or the right by the specified number of places.
naMe
introduced
Meaning
Left‐shift
JavaScript 1.0
v1 << v2
Shifts v1 to the left by v2 places, filling the
new gaps in with zeros.
Sign‐propagating
right‐shift
JavaScript 1.4
v1 >> v2
Shifts v1 to the right by v2 places, ignoring the
bits shifted off the number.
Zero‐fill right‐shift
JavaScript 1.0
v1 >>> v2
Shifts v1 to the right by v2 places, ignoring
the bits shifted off the number and adding v2
zeros to the left of the number.
logical operators
These should return one of the boolean literals, true or false . However, this may not happen if
v1 or v2 is neither a boolean value nor a value that easily converts to a boolean value, such as 0 , 1 ,
null , the empty string, or undefined .
naMe
introduced
Meaning
Logical AND
JavaScript 1.0
v1 && v2
Returns true if both v1 and v2 are true , or false
otherwise. Will not evaluate v2 if v1 is false .
Logical OR
JavaScript 1.0
v1 ││ v2
Returns false if both v1 and v2 are false , or true if
one operand is true . Will not evaluate v2 if v1 is true .
Logical NOT
JavaScript 1.0
!v1
Returns false if v1 is true , or true otherwise.
Search WWH ::




Custom Search