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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -