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 specifi ed number of places.
Name
Introduced
Meaning
Left-shift
JavaScript 1.0
v1 << v2
Shifts v1 to the left by v2 places, fi lling 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-fi ll
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.
Object Operators
JavaScript provides a number of operators to work with objects. The following table lists them.
Search WWH ::




Custom Search