Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "somevar >> 0" mean?


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

Thanks

like image 416
albanx Avatar asked Dec 22 '22 20:12

albanx


2 Answers

In a >> b, >> is a bitwise operator that shifts a in binary representation b (< 32) bits to the right, discarding bits shifted off. Reference: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Bitwise_Operators

like image 69
dheerosaur Avatar answered Jan 02 '23 05:01

dheerosaur


Bitwise right shift. Although somevar >> 0 looks weird.

like image 41
Anton Gogolev Avatar answered Jan 02 '23 06:01

Anton Gogolev