Possible Duplicate:
What do these operators do?
I’m working with some javascript for html 5’s canvas. I’m looking at some existing code and I’ve come across the following:
element.height >> 1
element.width >> 1
Its used as part of some arithmetic.
I am using prototype.js as well, if this helps.
>>is the bitwise shifting operator. So>> 1basically shifts the binary representation of the number on the left by one to the right. This is equal to an integer division by 2.So
element.height >> 1equals toMath.floor( element.height / 2)