-2

There is use of the "<<" in some code I am reading and I haven't been able to find any documentation on what exactly it does. I assume it is some bit wise function of some sort.

console.log(4<<3); 
//This prints out 32.

Any ideas?

dmckee --- ex-moderator kitten
  • 90,531
  • 23
  • 129
  • 225
Alpenglow
  • 153
  • 1
  • 17
  • [Arithmetic Shift](http://en.wikipedia.org/wiki/Arithmetic_shift). – VisioN Dec 23 '13 at 16:55
  • http://stackoverflow.com/questions/12122293/list-of-all-binary-operators-in-javascript – Gurfuffle Dec 23 '13 at 16:56
  • Huh... the stack overflow search didn't pick up any search results. I even just plainly searched "<< javascript" and other variations of that with no success. – Alpenglow Dec 23 '13 at 17:00

1 Answers1

5

From the Mozilla docs:

Left shift a << b

Shifts a in binary representation b (< 32) bits to the left, shifting in zeros from the right.

Community
  • 1
  • 1
Sterling Archer
  • 20,452
  • 15
  • 77
  • 107