You've gotten some great answers to your question, but let me talk about
the question behind the question: What Google search would have explained
<< to you right away?

Searching for punctuation marks doesn't usually work very well, so what
keywords would work? Well, obviously, "javascript" for starters. But what
to add to that? If you didn't know that << is a "bitwise operator", that
wouldn't help. But what about a word you actually used in your post,
"syntax"?

http://www.google.com/search?q=javascript+syntax

The first match is a Wikipedia page titled JavaScript Syntax. That sounds
promising, so let's open it.

Now it *is* easy to search for arbitrary text within a page in the browser,
so Ctrl+F (or Command+F or whatever) and we can type in the << we were
looking for. Bingo! We get to this section:

JavaScript supports the following *binary bitwise operators*:


&     And
|     Or
^     Xor

<<    Shift left  (zero fill)
>>    Shift right (sign-propagating); copies of the leftmost bit (sign bit) are 
>> shifted in from the
      left.
>>>   Shift right (zero fill)

      For positive numbers, >> and >>> yield the same result.

Now this doesn't do a very good job of explaining just what "Shift left
(zero fill)" means, but it's a start, and see the bold text at the top?
That leads us directly to the next search:

http://www.google.com/search?q=javascript+binary+bitwise+operators

and that will take you to the mozilla.org link Gary cited, along with all
sorts of other useful sites.

Hope that helps!

-Mike

p.s. Don't get me wrong, I don't mean to discourage you from asking about
stuff here. On the contrary, I'm glad you did, since it gave me a chance to
share a few search tips.

On Wed, Nov 2, 2011 at 11:54 AM, Matthew Bramer <[email protected]> wrote:

> I was looking at GitHub at some source code:
> https://github.com/mbebenita/Broadway/blob/master/Play/play.js
>
> and I found this function:
>
> function getRGB(r, g, b) {
>     return r << 24 | g << 16 | b;
> }
>
> I've never used these expressions before and am having difficulty finding 
> information about them.  Can anyone tell me what these are called and why I 
> would ever use them?  I'm confused over the "<<" syntax.
>
> Thanks,
> Matt
>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to