What does “somevar >> 0” mean?

前端 未结 3 752
野趣味
野趣味 2020-11-28 15:30


What does the notation somevar >> 0 mean in javascript?

Thanks

3条回答
  •  一向
    一向 (楼主)
    2020-11-28 16:09

    It's a bitwise operator. In this case, for shifting the first operand in binary representation the number of bits to the right specified in the second operand, discarding bits shifted off.

    With a 0 as second operand, I guess it has no effect (shifting 0 bits, is getting the same value?).

    I was wrong with this last. As explained at this @Gumbo's comment.

提交回复
热议问题