What do these JavaScript bitwise operators do? -
x <<= y (x = x << y)x >>= y (x = x >> y)x >>>= y (x = x >>> y)x &= y (x = x & y)x ^= y (x = x ^ y)x |= y (x = x | y)
what these different operators do?
<<, >> bit shift left , right, respectively. if imagine left operand binary sequence of bits, shifting left or right number of bits indicated right operand.
&, ^, | these bitwise and, xor, , or, respectively. can think of & , | counterparts && , ||, except treat operands bit vectors, , perform logical operations on each of bits. there no ^^ operator, operation "xor" or "exclusive or". can think of "a xor b" "a or b, not both".
Comments
Post a Comment