Here is an excerpt from a JS encryption script that I am studying.
function permutationGenerator(nNumElements) {
this.nNumElements = nNumElements;
| = bitwise or
1010
0100
----
1110
& = bitwise and
1011
0110
----
0010
so it's the same as && and || just with the single bits
<< is left shift, so
0110 << 2 shifts the numbers left by two positions, yielding 011000 another way to think of this is multiplication by two, so x<<1 == x*2, x<<2 == x*2*2 and so on, so it's x * Math.pow(2,n) for x<
>>
is the opposite, so 0110 >> 2 ---> 0001 you can think of it as division by two, BUT with rounding down, so it equals
Math.floor(x/Math.pow(2,n))